# Elasticsearch | max\_expansions True meaning

**URL:** <https://discuss.elastic.co/t/elasticsearch-max-expansions-true-meaning/172711>\
**Category:** Elasticsearch\
**Created:** [March 18, 2019, 6:31am UTC](https://discuss.elastic.co/t/elasticsearch-max-expansions-true-meaning/172711 "2019-03-18T06:31:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikesh/32/86579_2.png) [@Nikesh](https://discuss.elastic.co/u/Nikesh)\
**Post date:** [March 18, 2019, 6:31am UTC](https://discuss.elastic.co/t/elasticsearch-max-expansions-true-meaning/172711/1 "2019-03-18T06:31:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Nikesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikesh/32/86579_2.png) [@Nikesh](https://discuss.elastic.co/u/Nikesh)\
**Post date:** [March 19, 2019, 9:46am UTC](https://discuss.elastic.co/t/elasticsearch-max-expansions-true-meaning/172711/2 "2019-03-19T09:46:41Z")

</div>

@elastic

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2019, 9:46am UTC](https://discuss.elastic.co/t/elasticsearch-max-expansions-true-meaning/172711/3 "2019-04-16T09:46:55Z")

</div>

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