It's very common for users to commit a typewriting error or to need help to complete the words. This scenario is solved by ElasticSearch with the suggest functionality.
You need a working ElasticSearch cluster and an index populated with the script available in online code.
For suggesting a correct term by query, we need to perform the following steps:
From command line, we can execute the following suggest call:
curl -XGET 'http://127.0.0.1:9200/test-index/_suggest' -d ' { "suggest1" : { "text" : "we find tester", "term" : { "field" : "parsedtext" } } }'
The result returned by ElasticSearch, if everything is all right, should be as follows:
{ "_shards": { "failed": 0, "successful": 5, "total": 5 }, "suggest1": [ { "length": 2, "offset": 0, "options": [], "text": "we" }, { "length": 4, ...