DELETE /rosetta_account
POST /rosetta_account/account_number
{
"settings" : {
"number_of_shards" : 20,
"number_of_replicas" : 2,
"index_analyzer" : "standard",
"search_analyzer" : "standard",
"date_detection" : false
}
}
curl -s -XPOST localhost:9200/rosetta_account/account_number/_bulk --data-binary @data.file
{"took":68,"errors":true,"items":[{"create":{"_index":"rosetta_account","_type":"account_number","_id":"123456789","status":400,"error":"WriteFailureException; nested: MapperParsingException[failed to parse [customer_upgrade_dt]]; nested: MapperParsingException[failed to parse date field [], tried both date format [dateOptionalTime], and timestamp number with locale []]; nested: IllegalArgumentException[Invalid format: \"\"]; "}}
答案 0 :(得分:1)
根据你得到的错误:
failed to parse [customer_upgrade_dt] ...
tried both date format [dateOptionalTime], and timestamp number with locale ...
Invalid format: \"\"
这意味着在data.file
中包含的一个JSON文档中,您有一个名为customer_upgrade_dt
的字段,其值为空字符串""
,并且该字段无效日期字段,如果字段没有任何值,则需要将其设置为null
或根本不包括文档中的字段。显然,日期仍在检测中。
原因是您在索引设置中将date_detection
设置为false,但这不是放置该参数的正确位置,您需要将其添加到映射中而不是索引设置,即改为创建你的索引:
POST /rosetta_account/account_number
{
"settings" : {
"number_of_shards" : 20,
"number_of_replicas" : 2,
"index_analyzer" : "standard",
"search_analyzer" : "standard"
},
"mappings": {
"account_number": {
"date_detection": false
}
}
}