其实我的问题很简单:我想我的hashmap值not_analyzed!Spring Elasticsearch HashMap [String,String]映射值不能被分析
我现在有一个对象包含一个HashMap [字符串,字符串],看起来像:
class SomeObject{
String id;
@Field(type=FieldType.Object, index=FieldIndex.not_analyzed)
Map<String, String> parameters;
}
然后elasticsearch在beggining生成这样的映射弹簧数据:
{
"id": {
"type": "string"
},
"parameters": {
"type": "object"
}
}
在此之后我添加了一些对象的ES,它增加了更多像这样的属性:
{
"id": {
"type": "string"
},
"parameters": {
"properties": {
"shiduan": {
"type": "string"
},
"季节": {
"type": "string"
}
}
}
}
现在,因为的参数的价值进行了分析,所以不能通过es搜索,我的意思是不能搜索中文价值,我试过我可以在这个时候搜索英文。
随后,在阅读这篇文章https://stackoverflow.com/a/32044370/4148034,我手动更新映射这样的:
{
"id": {
"type": "string"
},
"parameters": {
"properties": {
"shiduan": {
"type": "string",
"index": "not_analyzed"
},
"季节": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
我可以立即搜索中文,所以我知道问题是“not_analyzed”,像帖子里说。
最后,任何人都可以告诉我如何使地图值“not_analyzed”,我有谷歌和stackoverflow许多次仍然找不到答案,让我知道如果有人可以帮助,非常感谢。
对不起,没有按时接受你的答案,它的工作原理。再次感谢你的帮助 –