elasticsearch,ttl,Indexing,elasticsearch,Ttl" /> elasticsearch,ttl,Indexing,elasticsearch,Ttl" />

Indexing 在创建后将_timestamp添加到索引中,以便ttl使用它而不是索引时间

Indexing 在创建后将_timestamp添加到索引中,以便ttl使用它而不是索引时间,indexing,elasticsearch,ttl,Indexing,elasticsearch,Ttl,我正在尝试在创建索引之后,以及在许多文档已经被索引之后,为我的文档类型启用_timestamp字段,以基于_timestamp字段而不是索引时间来更改ttl的行为 我的第一个问题是,在此时创建映射之后,这样添加映射是否会产生预期的效果 第二,当我试图添加这样一个映射时 curl -XPUT "http://localhost:9200/index/type/_mapping" -d' { "type": { "_timestamp" : {

我正在尝试在创建索引之后,以及在许多文档已经被索引之后,为我的文档类型启用_timestamp字段,以基于_timestamp字段而不是索引时间来更改ttl的行为

我的第一个问题是,在此时创建映射之后,这样添加映射是否会产生预期的效果

第二,当我试图添加这样一个映射时

    curl -XPUT "http://localhost:9200/index/type/_mapping" -d'
    {
      "type": {
      "_timestamp" : {
          "enabled" : true,
          "path" : "timestamp",
          "format" : "yyyy-MM-dd HH:mm:ss.SSS"
      }
    }
   }'
我得到以下错误:
无法更新时间戳值中的路径。值为空合并映射中的路径丢失

我不确定问题出在哪里,因为每个文档都包含时间戳字段

我现有的映射是:

{
  "events_index" : {
    "mappings" : {
      "events" : {
        "dynamic_templates" : [ {
          "notanalyzed" : {
            "mapping" : {
              "index" : "not_analyzed",
              "doc_values" : true,
              "type" : "string"
            },
            "match" : "*",
            "match_mapping_type" : "string"
          }
        } ],
        "_ttl" : {
          "enabled" : true,
          "default" : 2592000000
        },
        "properties" : {
          "@timestamp" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },
          "@version" : {
            "type" : "string",
            "index" : "not_analyzed",
            "doc_values" : true
          },
          "event" : {
            "properties" : {
               "event_hash" : {
               "type" : "string",
               "index" : "not_analyzed",
               "doc_values" : true
          },
          "geoip" : {
            "properties" : {
              "location" : {
                "type" : "geo_point"
              }
            }
          },
          "timestamp" : {
            "type" : "date",
            "format" : "yyyy-MM-dd HH:mm:ss.SSS"
          },
          "type" : {
            "type" : "string",
            "index" : "not_analyzed",
            "doc_values" : true
          },
          "user" : {
            "properties" : {
              "username" : {
                "type" : "string",
                "index" : "not_analyzed",
                "doc_values" : true
              }
            }
          }
        }
      }
    }
  }
}

您还可以分享您的完整映射吗?更新了问题以包含完整映射