这是解决我的问题的可行方法,也许对某人有用。
位置映射:
{ "location" : { "properties": { "name": { "type": "string", "boost": 2.0, "analyzer": "snowball" }, "description": { "type": "string", "analyzer": "snowball" }, "geo": { "type": "geo_point" } } }}展品图:
{ "exhibit": { "_parent": { "type": "locations" }, "properties": { "name": { "type": "string", "boost": 2.0, "analyzer": "snowball" }, "description": { "type": "string", "analyzer": "snowball" } } }}查询:
{ "fields": [ "_parent", "name", "_source" ], "query": { "bool": { "should": [ { "text": { "name": "candy" } }, { "text": { "description": "candy" } } ] } }, "filter": { "and": [ { "terms" : { "_parent": [ "4e7089a9b97d640b30695b7a", "4e7089eeb97d640b30695b7b" ] } }, { "range": { "start": { "lte": "2011-09-22" } } }, { "range": { "end": { "gte": "2011-09-22" } } } ] }}您应该使用该
_parent字段进行查询,并将该字段传递给您要将展览品限制到的位置的ID数组。



