elasticsearchelasticsearch-6

Set default value to elasticsearch index.max_inner_result_window parameter


I'm actually using elasticsearch 6.7 and I get an error while searching in ES :

Top hits result window is too large, the top hits aggregator [instances]'s from + size must be less than or equal to: [100] but was [2147483647]. This limit can be set by changing the [index.max_inner_result_window] index level setting.

I know how to change this parameter, this is not the issue.

I actually use this to change the parameter on existing indexes:

PUT _all/_settings
{
  "index.max_inner_result_window": "2147483647"
}

However, elasticsearch will not update future indexes that will be created.

My app often put documents in new indexes. If the index doesn't exist, elasticsearch creates it. However I don't want to run this request everytime a document is put inside an index.

The issue is when a new index is created when a document is put inside, it keep the default value to 100 for this index.

There is a paramter in es.yaml to set the default limit, however, it seems to be deprecated and not working.

What I want is that ES set automatically the limit to the integer max value when a new index is created without running the request each time I put a document in ES.

Thank you for reading, hope you can help me.

Regards, Jules


Solution

  • Can you try defining this in the index template like below so that all the new index created will have this setting.

    {
        "index_patterns": [
            "*" // note this
        ],
        "template": {
            "settings": {
                "index":{
                    "max_inner_result_window": 2147483647
                }
            }
        }
    }