Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
421 views
in Technique[技术] by (71.8m points)

autosuggest - Elasticsearch-7.8.1 is intermittently showing random suggestions during phrase suggestion

I've an Elasticsearch-7.8.1 running in 3-node cluster setup. I use a match query on fields along with phrase suggester for querying the documents across multiple indices.

Now coming to the problem, whenever I use the above mentioned match query to search for a matching document with exact spelling of the document which is present in my elasticsearch the phrase suggester part shows me some random suggestion and the suggestion that I get is intermittent for same input text.

For eg, Lets say I have some 3-4 documents indexed like Bills, How do I do Bill Pay ,What is the status of Bill payment, What are the benefits of bigger Bill payments ?

My query is as follows:

GET idx-name1,idx-name2/_search
{
 "query": {
    "bool": {
      "should": [
        {
          "match": {
            "field1": "bill pay"
          }
        },
        {
          "match": {
            "field2": "bill pay"
          }
        }
      ]
    }
  },
  "suggest": {
    "text": "bill pay",
    "YOUR_SUGGESTION": {
      "phrase": {
        "field": "field1"
      }
    }
  }
}

Output: I intermittently get suggestion as "bigg pay" in phrase suggester part.

Please help me, this is acting as a barrier for me in creating 'Did you mean functionality ?'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to provide more information to debug your issue, but few pointers so that you can debug it yourself or provide the information so that we can help you further.

  1. Provide your index mapping and setting, please refer this and this to know how to get it
  2. Use explain API to see how your search is woking under the hood.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...