在这里,我给我更新的映射如何在elasticsearch中进行完全匹配?
curl -X PUT localhost:9200/testing/listings/_mapping -d '{
"listings" : {
"properties" : {
"address" : {
"properties": {
"location": { "type" : "string",
"index" : "not_analyzed"
}
}
},
"suggest" : { "type" : "completion",
"index_analyzer" : "simple",
"search_analyzer" : "simple",
"payloads" : true
}
}
}
}'
我的映射如下
{
"testing": {
"mappings": {
"listings": {
"properties": {
"address": {
"properties": {
"city": {
"type": "string"
},
"line1": {
"type": "string"
},
"line2": {
"type": "string"
},
"line3": {
"type": "string"
},
"location": {
"type": "string",
"index": "not_analyzed"
},
"pincode": {
"type": "string"
}
}
},
"title": {
"type": "string"
}
}
}
}
}
}
但是我的数据不匹配创建的索引。
我的样本数据是
{
"listings": {
"title": "testing 3",
"address": {
"line1": "3rd cross",
"line2": "6th main",
"line3": "",
"landmark": "",
"location": "k r puram",
"pincode": "",
"city": "Bangalore"
}
}
}
当我给查询作为k r puram
我得到了匹配的结果。
但是,当我给查询为r r puram
或r k puram
那次我也得到了属于k r puram
的结果。
在上面的查询中,我只列出了k r puram
列表中的其他人我没有列出所以除k r puram
之外它应该给出空的结果。
这是我的查询:
{
"query": {
"bool": {
"must": [
{
"match": {
"published": true
}
},
{
"match": {
"inActive": false
}
},
{
"range": {
"propertyDetailsCategory.build_up_area": {
"lte": 200
}
}
},
{
"match": {
"type": "commercial"
}
},
{
"match": {
"purpose": "rent"
}
},
{
"range": {
"commercialsCategory.exp_rent": {
"lte": 50000
}
}
},
{
"match": {
"address.location": "k r puram"
}
}
]
}
}
}
1.为什么要使用multi_match只针对单场? 2.“address.location”实际包含什么? 3.如何分析? – 2014-12-19 11:34:23
我也用那场比赛也是同样的结果来了。 address.location包含位置,'address.location'是列表对象中的字段'。 @OllyCruickshank – 2014-12-19 11:39:06
让我重新解释一下我的问题 - “address.location”是否包含“kr puram”的确切值? – 2014-12-19 11:52:08