Search code examples
pythonelasticsearchelasticsearch-dsl

ElasticSearch DSL -> Combine multiple filters and eliminate metadata


The following query is suppose to return the documents where the product_id is 12.

request = Search(using=client, index='myIndex') \
            .filter("match",product_id=12) \
            .source(myFieldsArray)

Now i would like to also cut out all documents where parent is null.
I would like also that the metadata not be returned, only the actual data (on kopf i use filter_path=hits.hits._source.* on the query string)

How can i do these on elastic search-dsl?

Details: using Elasticsearch 2.4


Solution

  • filters can be chained, just .filter( away. In order to eliminate metadata you must set the params like .params(filter_path="hits.hits._source.*")