Can someone explain how to do a real-time search with ElasticSearch? For example, to show the results of a line on a web page after entering the keyboard. (just like Jquery autocomplete).

I know that there are some libraries, but I do not understand the client part, should it be an AJAX request for PHP or a URL?

What is the easiest way to do this?

    2 answers 2

    The page should have javascript that will execute an AJAX request, this can be your script or part of a component The server part should be responsible for finding and responding to this script.

    Making elasticsearch accessible from the Internet is not safe. I would make a php script with a library call to work with elascticsearch, for example Elasticsearch-PHP, which would form a query to elasticsearch and return JSON in response.

    As one and examples of implementation would pay attention to this article .

      ElasticSearch specifically offers the Suggesters API: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html