Match_phrase_prefix in Elasticsearch 7.3.0

Why I got 7 results for "6531 148 str" but no results for "6531 148 st"?

Is it because there are more than 50 terms in the sorted term dictionary between "st" and "str" based on https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html? And for each of those terms, there is no search result?

Thanks!

[Case 1]

  • Request
    GET /_search
    {
    "query": {
    "match_phrase_prefix" : {
    "address" : "6531 148 st"
    }
    }
    }
  • Response
    {
    "took": 11,
    "timed_out": false,
    "_shards": {
    "total": 3,
    "successful": 3,
    "skipped": 0,
    "failed": 0
    },
    "hits": {
    "total": {
    "value": 0,
    "relation": "eq"
    },
    "max_score": null,
    "hits":
    }
    }

[Case 2]

  • Request
    GET /_search
    {
    "query": {
    "match_phrase_prefix" : {
    "address" : "6531 148 str"
    }
    }
    }
  • Response
    {
    "took": 668,
    "timed_out": false,
    "_shards": {
    "total": 3,
    "successful": 3,
    "skipped": 0,
    "failed": 0
    },
    "hits": {
    "total": {
    "value": 7,
    "relation": "eq"
    },
    ......

Yes, that could very well be it. There could be many more than 50 terms that start with st and as a result you may miss out on street. You could try increasing max_expansions to a higher number, but keep in mind that this will make the query more expensive.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.