0

I try to use elastic suggester so when user start to type some text, autocomplete will help him. do I need to do something specific on mapping for that index?

if I insert this document to 'init' index:

POST init/_doc
{
 "device": "comp-1",
  "startTime":1984562456000,
   "endTime":1984662456000,
  "fileName":"myFirstFile.parquet"
}

and then my query for suggest is:

POST init/_search
{
  "suggest": {
    "my-suggest-1" : {
      "text" : "my",
      "term" : {
        "field" : "fileName"
      }
    }
  }
}

but result has no suggestion.

what am I doing wrong?

thanks, Larry

larry ckey
  • 141
  • 2
  • 14
  • can you share your elasticsearch index mapping and do you strictly want to use `suggestor` only as still this feature is in development and you can use the other alternatives – Amit Mar 29 '20 at 11:28
  • you can also you through https://opster.com/elasticsearch-glossary/elasticsearch-autocomplete-troubleshooting-guide/ and let me know which one suits your requirements – Amit Mar 29 '20 at 11:54
  • what about 'phrase-suggester'? https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#phrase-suggester – larry ckey Mar 30 '20 at 06:17
  • if it matches your requirement, then you can go with it as well, I've used this as well on your dataset and for `my` it works fine but for queries like `my file` it wouldn't work, anyway, if you can share some more samples and expected output I can provide the answer, and did you get a chance to go through the blog and see which one suits your requirement more and based on that also I can provide some working samples – Amit Mar 30 '20 at 07:02
  • more info on this https://stackoverflow.com/questions/60584099/autocomplete-with-java-redis-elastic-search-mongo/60584211#60584211 answer of mine, please go through it as well – Amit Mar 30 '20 at 07:03
  • general question: for the simple suggester (the one I asked at the first question), should I set some special mapping or not? – larry ckey Mar 30 '20 at 08:11

0 Answers0