以下映射中字段版本的類型是日期。但是在groups/_mapping中列出的版本類型是文本。映射或設置有什麼問題嗎?謝謝。類型日期已被隱藏到elasticsearch中的文本(v5.4.0)
映射:
PUT groups
{
"settings": {
"index.mapping.ignore_malformed": true
},
"mappings": {
"shop": {
"_all": { "enabled": false },
"dynamic": "false",
"date_detection" : false,
"properties": {
"sid": { "type": "keyword"},
"version": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
}
}
此結果是。
{
"acknowledged": true,
"shards_acknowledged": true
}
結果從http://host:9200/groups/_mapping
{
"groups": {
"mappings": {
"shop": {
"properties": {
"sid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
插入數據如下:
{'sid': '772634b9b9a8437f9cbfaec2b546f8af', 'version': '20131209 15:19:04'}
響應:
{
'_id': '772634b9b9a8437f9cbfaec2b546f8af',
'_index': 'groups_version',
'_shards': {'failed': 0, 'successful': 2, 'total': 2},
'_type': 'shop',
'_version': 1,
'result': 'created',
}
的asdas
我看起來像你的'PUT groups'請求的整個身體被忽略。 '_mapping'不會只顯示日期字段的錯誤類型 - 如果索引是用你的PUT的整個體創建的,它還應該顯示'「sid」:{「type」:「keyword」}','「date_detection」: false'和'「_all」:{「enabled」:false}'。我重新創建了這個問題,對我來說這一切都很好(v 5.4)。你確定在創建索引時,你會得到200 OK嗎?「確認」:true'作爲響應? – Joanna
我使用kibana來創建索引並通過python腳本插入數據。是的,「已確認」:返回true。我也在使用v5.4.0。 –