diff --git a/defaults/main.yml b/defaults/main.yml index cd02fa0..9aa0a23 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -41,6 +41,8 @@ es_mapping_total_fields_limit: 1000 # Mappings for fields enforced by default template es_default_template_mappings: {} +# Query optimization to not search throguh all fields. Can be a list. +es_default_query_default_field: '*' # Tuning es_node_concurrent_recoveries: 2 diff --git a/tasks/shards_conf.yml b/tasks/shards_conf.yml index 73493ee..80a4ca4 100644 --- a/tasks/shards_conf.yml +++ b/tasks/shards_conf.yml @@ -7,6 +7,7 @@ timeout: 40 - name: 'Set number of replicas to {{ es_number_of_replicas }} for all new indices' + register: wtg uri: url: 'http://localhost:{{ es_api_port }}/_template/default_template' method: PUT @@ -17,7 +18,12 @@ "index_patterns": ["*"], "mappings": {{ es_default_template_mappings | to_json }}, "settings": { - "index": { "mapping": { "total_fields": { "limit": {{ es_mapping_total_fields_limit | to_json }} } } }, + "index": { + "query": { "default_field": {{ es_default_query_default_field | to_json }} }, + "mapping": { + "total_fields": { "limit": {{ es_mapping_total_fields_limit | to_json }} } + } + }, "number_of_replicas": {{ es_number_of_replicas | to_json }}, "number_of_shards": {{ es_number_of_shards | to_json }} }