filtering facets in elasticsearch
问题 I have a query like below, query = { "query": {"query_string": {"query": "%s" % q}}, "filter":{"ids":{"values":list(ids)}}, "facets": {"destination": { "terms": {"field": "destination.en"}}, "hotel_class":{ "terms":{"field":"hotel_class"}}, "hotel_type":{ "terms":{"field": "hotel_type"}}, }} But my facets are not filtered due to my ids filter. I get all the facets, but I want them filtered by my ids filter above. Do you have any ideas ? 回答1: Although what you do works, a cleaner solution