[英]Elasticsearch array of strings being tokenized even with no_analyzed in mapping
這讓我發瘋。 我的數據中有幾個數組,這是精簡版:
{
"fullName": "Jane Doe",
"comments": [],
"tags": [
"blah blah tag 1",
"blah blah tag 1"
],
"contactInformation": {
"attachments": [
"some file 1",
"some file 2",
"some file 3"
]
}
}
好的,所以我在elasticsearch中的映射如下:
curl -XPOST localhost:9200/myindex -d '{
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"docs" : {
"properties" : {
“tags” : { "type" : "string", "index" : "not_analyzed" }
“attachments” : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}'
現在,如果我將它們顯示為構面,則標記看起來很好,如下所示:
[]-等等標簽1
[]-等等標簽2
但是附件被標記化了,每個單詞我都有一個方面,即
[]-一些
[]-文件
[]-1
我一直在想,因為附件屬性位於contactInformation內部,所以我的映射可能需要如下所示:“ contactInformation.attachments”:{“ type”:“ string”,“ index”:“ not_analyzed”}
但這引發了一個錯誤,沒想到會出現點。
有任何想法嗎?
請參閱“復雜核心字段類型”文檔(尤其是標題為“內部對象的映射”的部分 )。
它看起來應該像這樣:
"mappings" : {
"docs" : {
"properties" : {
“tags” : { "type" : "string", "index" : "not_analyzed" },
"contactInformation": {
"type": "object",
"properties": {
“attachments” : { "type" : "string", "index" : "not_analyzed" }
}
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.