Skip to content

Nested filter error #17

Closed
Closed
@Benoss

Description

@Benoss

I am using the query DSL to create a nested filter

query = query.filter("nested", f.Bool(must=filter_variants), path="object.info.variants")

object.info.variants is an array of nested documents in my case

And I have this error at execution
nested: QueryParsingException[[myindexname] [nested] filter does not support [filters]]

the nested part of the query generated by the DSL looks like this

             {
              "nested": {
                "path": "object.info.variants", 
                "filters": {
                  "bool": {
                    "must": [
                      {
                        "term": {
                          "object.info.variant.purchase_status.notanalyzed": "IN_STOCK"
                        }
                      }, 
                      {
                        "terms": {
                          "object.info.variants.search_sizes": [
                            "8", 
                            "9"
                          ]
                        }
                      }
                    ]
                  }
                }

line 10 of filter.py

    if filters is not None:
        params['filters'] = filters

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-nested-filter.html#query-dsl-nested-filter
I changed "filters" to "filter" it is working for me.

I don't know if some filters are expecting "filters" instead of "filter", maybe the new aggregations filters in ES 1.4 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-filters-aggregation.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions