一个索引的弹性搜索中的多个映射
Multiple Mappings in elastic search for one single Index
我在弹性搜索中有一些字段类型为字符串和索引为 not_analysed。
有时在搜索这些字段的值时,我也需要分析的索引。
那么是否可以在elasticsearch中对一个索引进行多重映射
在我的例子中,一个用于索引 not_analysed,第二个用于分析的索引。
谢谢
穆克什·拉古万希
当然可以,您可以使用 multi-field
来达到这个目的。您的字段需要在您的映射类型中声明如下:
{
"your_type" : {
"properties" : {
"your_field" : { <-- this is the analyzed version of the field
"type" : "string",
"index" : "analyzed",
"fields" : {
"raw" : { <-- this is the not_analyzed sub-field
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
我在弹性搜索中有一些字段类型为字符串和索引为 not_analysed。
有时在搜索这些字段的值时,我也需要分析的索引。
那么是否可以在elasticsearch中对一个索引进行多重映射
在我的例子中,一个用于索引 not_analysed,第二个用于分析的索引。
谢谢 穆克什·拉古万希
当然可以,您可以使用 multi-field
来达到这个目的。您的字段需要在您的映射类型中声明如下:
{
"your_type" : {
"properties" : {
"your_field" : { <-- this is the analyzed version of the field
"type" : "string",
"index" : "analyzed",
"fields" : {
"raw" : { <-- this is the not_analyzed sub-field
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}