Elasticsearch:如何为所有索引全局禁用自动日期检测

Sou*_*ral 5 elasticsearch

如何在 elasticsearch 中全局禁用所有索引的自动检测?我发现可以通过动态映射禁用单个索引(来源:https : //www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html

但我想通过 elasticsearch.yml 中的一些命令全局执行此操作。有没有办法做到这一点?

Oli*_*Oli 0

我通过更改全局 Elasticsearch 模板解决了这个问题(检查一下,如果全局模板中已经有任何想要保留的重要设置,那么您还需要将它们复制粘贴到 json 中):

curl -X PUT "$HOSTNAME:9200/_template/global?pretty" -H 'Content-Type: application/json' -d'
{
    "index_patterns" : ["logstash-*"], ####here your index pattern for the setting####
    "order" : 0,
    "mappings": {
      "doc": {
        "date_detection": false
      }
    } 
}'
Run Code Online (Sandbox Code Playgroud)