In the above code, replace <index_url> with a real index URL in a format like http://es-api01.episerver.com/HrkbWMOkwslDEZ8Mhhunk9FX10s0fAx1/myindex. Also, if the documents have been indexed using the .NET client API, the "Title" field is named Title$$string.

This is a simple example of implementing autocomplete functionality. You can customize it in a few ways, such as limiting the returned documents to a certain type by adding a type name after the index URL.

Note: To generate the statistics on which automatically-generated suggestions are based, you must add .Track() to normal queries.

Posting queries

To post queries, create the query object and POST it to EPiServer.Find. EPiServer.Find supports most native ElasticSearch queries. A simple prefix autocomplete on the "Title" field looks like this.