Elasticsearch | max_expansions True meaning

Hi,

I have few doubts over max_expansions of Fuzziness.
I created a Index A.
I have copy_to enabled in it.

Index A contains single document :

{
  "ID": "AUTO20029",
  "ID_1": "AUTO20029",
  "NAME": "AUTO20029",
  "ID_3": "AUTO20027",
  "ID_4": "AUTO20026",
  "ID_5": "1634e9cad015476fa24c8c97f972b7f4"
}

The query I am developing is

{
  "from": 0,
  "size": 20,
  "query": {
    "bool": {
      "should": [
        {
          "multi_match": {
            "query": "auto20005",
            "boost": "10",
            "operator": "and",
            "analyzer": "whitespace",
            "fuzziness": "AUTO:4,7",
            "prefix_length": 1,
            "max_expansions": 2,
            "fields": [
              "COPY_TO_FIELD"
            ]
          }
        }
      ],
      "minimum_should_match": 1,
      "filter": [
        {
          "terms": {
            "ID.keyword": [
              "1634e9cad015476fa24c8c97f972b7f4"
            ]
          }
        }
      ]
    }
  },
  "highlight": {
    "type": "unified",
    "fragment_size": 0,
    "order": "score",
    "number_of_fragments": 4,
    "fields": {
      "*": {
        "require_field_match": "false"
      }
    }
  }
}

Since I have mentioned omax_expansions value as 2, only two fuzzy matches per shard has to be chosen.
But my highlight shows all the matches.

{
  "highlight": {
    "ID": [
      "<em>AUTO20029</em>"
    ],
    "ID_3": [
      "<em>AUTO20027</em>"
    ],
    "ID_4": [
      "<em>AUTO20026</em>"
    ],
    "NAME": [
      "<em>AUTO20029</em>"
    ],
    "ID_5": [
      "<em>1634e9cad015476fa24c8c97f972b7f4</em>"
    ],
    "ID_5.keyword": [
      "<em>1634e9cad015476fa24c8c97f972b7f4</em>"
    ],
    "ID_1": [
      "<em>AUTO20029</em>"
    ]
  }
}

Please let me know where am I going wrong?

@elastic

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