0

I have a very strange case and I cannot understand why this happens. This is part of the query.

      "must": [
        {
          "multi_match": {
            "query": "makkara",
            "type": "best_fields",
            "fields": ["text.general", "text.fi"],
            "minimum_should_match": 10
          }
        }
      ]

text.general field is a trigrams field, meaning it's analyzed with a ngram filter, where max and min gram are 3. Basically, the are five tokens: "mak", "akk", "kka", "kar", "ara". The field "text.fi" is analyzed with Finnish analyzer. I've tried it and it returns "makkar" (pretty stupid, actually).

So the issue is in how this minimum should match works. I don't get its mechanics. As soon as it becomes 5 it returns the same results no matter what I put there. Anything >=5 returns same results. Could someone explain why is it so?

elena
  • 3,740
  • 5
  • 27
  • 38
  • This would probably help: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#operator-min – Val Aug 03 '18 at 06:02
  • @Val I definitely did check this part. Thanks though – elena Aug 08 '18 at 00:41
  • @elena, I didn't understand what do you mean by As soon as it becomes 5 it returns the same results no matter what I put there? – Amit Dec 16 '19 at 02:45

1 Answers1

0

As per your question, the number of tokens generated by analyzers of both fields for search term "makkara" is <= 5. So, the minimum_should_match = 5 in this case would mean all search terms must be present.

And hence, any minimum_should_match value greater than 5 will still mean all the 5 terms must be present. This is why you don't see change in results for values greater than 5.

Barkha Jain
  • 758
  • 5
  • 14