Add a default field
Technical Preview
In Elasticsearch 7.0 and later, some query types, such as simple query string, have a limit to the number of fields they can query against. To configure the cap in Elasticsearch, set the indices.query.bool.max_clause_count
cluster setting, which is 1024 by default.
For indices with more fields than the cap, add the index.query.default_field
index setting to inform Elasticsearch which fields to use by default when no field is specified for a query. Use the add default field API to add the index.query.default_field
setting to an Elasticsearch index.
To add the index.query.default_field
index setting to the specified index, Kibana generates an array of all fields from the index mapping. The fields contain the types specified in fieldTypes
. Kibana appends any other fields specified in otherFields
to the array of default fields.
Body
Required
-
fieldTypes
array Required An array of Elasticsearch field types that generate the list of fields.
-
otherFields
array An optional array of additional field names, dot-delimited.
curl \
--request GET 'https://localhost:5601/api/upgrade_assistant/add_query_default_field/{index}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"fieldTypes\": [\"text\", \"keyword\"], \n \"otherFields\": [\"myField.*\"] \n}"'
{
"fieldTypes": ["text", "keyword"],
"otherFields": ["myField.*"]
}
{
"acknowledged": true
}