簡體   English   中英

映射索引Elasticsearch時間戳定制

[英]Mapping index Elasticsearch timestamp custom

我在Elasticsearch中上傳索引時遇到問題。

curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d "{\"mappings\":{\"timestamp\":{\"type\":\"date\",\"format\":\"yyyy-MM-dd\"}}}"

我收到此錯誤:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [format : yyyy-MM-dd] [type : date]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [timestamp]: Root mapping definition has unsupported parameters:  [format : yyyy-MM-dd] [type : date]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [format : yyyy-MM-dd] [type : date]"}},"status":400}

為什么我的curl命令錯誤?

謝謝。

您缺少類型聲明:

curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d '{
   "mappings":{
     "your_type_name": {                <--- add this
         "properties": {                <--- and this
            "timestamp":{
              "type":"date",
              "format":"yyyy-MM-dd"
            }
         }
      }        
   }
}'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM