Home > Software design >  How to find default value/change search.allow_expensive_queries in Elasticsearch
How to find default value/change search.allow_expensive_queries in Elasticsearch

Time:06-28

I wonder if there is a way to see default value of Elasticsearch param search.allow_expensive_queries (e.g. in Kibana) and change it if necessary via console of DevTools or environment section of docker-compose.yml?

CodePudding user response:

By default search.allow_expensive_queries value is set to true, if you want to prevent users from running certain types of expensive queries, then you can add this setting to the cluster:

PUT _cluster/settings
{
  "transient": {
    "search.allow_expensive_queries": "false"
  }
}

To check if the setting is set or not in the cluster you can call this API:

GET /_cluster/settings

and result should be like below if it is set to false or true:

{
  "persistent" : { },
  "transient" : {
    "search" : {
      "allow_expensive_queries" : ["false" or "true"]
    }
  }
}

If no information is retuned by the API in transient part it means that the value is set to true.

  • Related