The Source Example you can see below is being returned by a query on "thin". However, you can see in my query that I'm trying to filter docs using the filter exists "sbb" field. With this query, the Source Example should not be returned because it does not have an "sbb" field correct? Where I have gone wrong in my query or mapping?
Mapping:
"mappings": {
"mymap": {
"_all": {
"enabled": false
},
"properties": {
"sbb": {
"type": "boolean"
},
"sku": {
"type": "string",
"analyzer": "full_name",
"fields": {
"exact": {
"type": "string",
"index": "not_analyzed"
},
"partial": {
"type": "string",
"index_analyzer": "partial_name",
"search_analyzer": "full_name"
}
}
},
"title": {
"type": "string",
"analyzer": "full_name",
"fields": {
"partial": {
"type": "string",
"index_analyzer": "partial_name",
"search_analyzer": "full_name"
},
"sortable": {
"type": "string",
"analyzer": "sortable"
}
}
}
}
}
}
Query:
"query":{
"filtered":{
"query":{
"bool":{
"should":[
{
"match":{
"title":{
"query":"thin",
"operator":"and",
"boost":5,
"fuzziness":"0"
}
}
},
{
"match":{
"title":{
"query":"thin",
"boost":2,
"fuzziness":"AUTO"
}
}
}
]
}
},
"filter": {
"exists": {
"field": "sbb"
}
}
}
}
Source Example:
"_source": {
"title": "Mexican Service Medal Thin Ribbon",
"tags": [
"EZR",
"ISP_IGNORE_PRODUCT_TAG",
"sbb?_w=50&h=14",
"SBB_Awards",
"Thin Ribbon"
]
}