1

对于特定查询,我如何按字段(语音名称、名称)定义单独的查询分析器。只需在索引/类型的放置映射中为语音名称和名称定义搜索分析器?

{
    "query_string" : {
        "fields" : ["phonetic_name", "name^5"],
        "query" : "italian food",
        "use_dis_max" : true
    }
} 
4

1 回答 1

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"},
      }
    }
  }
}'
于 2012-05-09T01:11:53.327 回答