你好Elasticsearch Gurus在那裏。Elasticsearch映射和字段類型
考慮以下指標和文檔類型: 本地主機:9200/myindex/mydoctype
我現在有這個指標定義:
{
"myindex": {
"aliases": {},
"mappings": {
"mydoctype": {
"properties": {
"theNumber": {
"type": "integer"
},
"theString": {
"type": "string"
}
}
}
},
"settings": {
"index": {
"creation_date": "1487158714808",
"number_of_shards": "5",
"number_of_replicas": "1",
"version": {
"created": "1070599"
},
"uuid": "cm2OtivhTO-RjuZPeHvL1w"
}
},
"warmers": {}
}
}
,我能夠將這份文件加入:
{
"theNumber" : 0,
"theString" : "zero"
}
但是我沒想到,就是,我還可以將這份文件加入:
{
"theNumber" : 3.1418,
"theString" : 3,
"fiefoe" : "fiefoe"
}
...其中的字段類型不匹配。 以及有一個新的領域/專欄介紹。 由於我爲索引定義的映射,我並不期待這種行爲。
這是否與Elasticsearch無模式有關? 是否可以將Elasticsearch設置爲只接受爲該索引添加的每個文檔的那些類型和字段? 這是彈性搜索映射的工作原理嗎? (也許我不知道呵呵呵)
感謝=)
非常感謝@christinabo。這真的很有幫助。 –
@ArtanisZeratul我希望它能解決這個問題。 – christinabo
請在下方檢查我的答案,這可能對您也有幫助。謝謝。 –