对于特定查询,我如何定义单独的查询分析器 字段(phonetic_name,name)。只需为phonetic&定义search_analyzers即可。在索引/类型的放置映射中的名称?
{
"query_string" : {
"fields" : ["phonetic_name", "name^5"],
"query" : "italian food",
"use_dis_max" : true
}
}
答案 0 :(得分:3)
您可以在创建索引时为字段指定分析器,例如:
curl -s -XPOST localhost:9200/myindex -d '{
"mappings":{
"mytype":{
"properties":{
"field1":{"store":"yes","index":"not_analyzed","type":"string"},
"field2":{"store":"yes","analyzer":"whitespace","type":"string"},
"field3":{"store":"yes","analyzer":"simple","type":"string"},
}
}
}
}'