I just organized the structure of my document in order to have a more OO design (for example, migrated top-level properties such as venueId and venueName ) into an venue object with id and name fields).
However, now I cannot get a simple term filter that works for the fields of the child venue internal object.
Here is my mapping:
{ "deal": { "properties": { "textId": {"type":"string","name":"textId","index":"no"}, "displayId": {"type":"string","name":"displayId","index":"no"}, "active": {"name":"active","type":"boolean","index":"not_analyzed"}, "venue": { "type":"object", "path":"full", "properties": { "textId": {"type":"string","name":"textId","index":"not_analyzed"}, "regionId": {"type":"string","name":"regionId","index":"not_analyzed"}, "displayId": {"type":"string","name":"displayId","index":"not_analyzed"}, "name": {"type":"string","name":"name"}, "address": {"type":"string","name":"address"}, "area": { "type":"multi_field", "fields": { "area": {"type":"string","index":"not_analyzed"}, "area_search": {"type":"string","index":"analyzed"}}}, "location": {"type":"geo_point","lat_lon":true}}}, "tags": { "type":"multi_field", "fields": { "tags":{"type":"string","index":"not_analyzed"}, "tags_search":{"type":"string","index":"analyzed"}}}, "days": { "type":"multi_field", "fields": { "days":{"type":"string","index":"not_analyzed"}, "days_search":{"type":"string","index":"analyzed"}}}, "value": {"type":"string","name":"value"}, "title": {"type":"string","name":"title"}, "subtitle": {"type":"string","name":"subtitle"}, "description": {"type":"string","name":"description"}, "time": {"type":"string","name":"time"}, "link": {"type":"string","name":"link","index":"no"}, "previewImage": {"type":"string","name":"previewImage","index":"no"}, "detailImage": {"type":"string","name":"detailImage","index":"no"}}} }
Here is a sample document:
GET /production/deals/wa-au-some-venue-weekends-some-deal { "_index":"some-index-v1", "_type":"deals", "_id":"wa-au-some-venue-weekends-some-deal", "_version":1, "exists":true, "_source" : { "id":"921d5fe0-8867-4d5c-81b4-7c1caf11325f", "textId":"wa-au-some-venue-weekends-some-deal", "displayId":"some-venue-weekends-some-deal", "active":true, "venue":{ "id":"46a7cb64-395c-4bc4-814a-a7735591f9de", "textId":"wa-au-some-venue", "regionId":"wa-au", "displayId":"some-venue", "name":"Some Venue", "address":"sdgfdg", "area":"Swan Valley & Surrounds"}, "tags":["Lunch"], "days":["Saturday","Sunday"], "value":"$1", "title":"Some Deal", "subtitle":"", "description":"", "time":"5pm - Late" } }
And here is the βexplainβ test in the same document:
POST /production/deals/wa-au-some-venue-weekends-some-deal/_explain { "query": { "filtered": { "filter": { "term": { "venue.regionId": "wa-au" } } } } } { "ok":true, "_index":"some-index-v1", "_type":"deals", "_id":"wa-au-some-venue-weekends-some-deal", "matched":false, "explanation":{ "value":0.0, "description":"ConstantScore(cache(venue.regionId:wa-au)) doesn't match id 0" } }
Is there a way to get more useful debugging information? Is there something wrong with describing the result of the explanation? Just saying "does not match id 0" doesn't really make sense to me ... the field is called "regionId" (not "id"), and the value is definitely not 0 ... ???