TypeError: unhashable type: "Term"

Hi, I'm working with elasticsearch-dsl package (version 2.5)

This is my query being formed with the help of elasticsearch-dsl package.

Python code for building query:

if self._filters:
    base = base.filter('bool', must=self._filters)

where self._filters = [] is class constructor and it returns me this query:

{
    'must': 
        [
           Term(id=28300)
        ]
}

I'm facing some issues with it. There is some class in elasticsearch-dsl package like this:

Query.get_dsl_class(name_or_query)(**params)

and get_dsl_class method looks like this:

def get_dsl_class(cls, name):
    try:
        return cls._classes[name]  <-- throwing error from here
    except KeyError:
        raise UnknownDslObject('DSL class `%s` does not exist in %s.' % (name, cls._type_name))

I'm getting this error: "TypeError: unhashable type: "Term"". I'm not sure how to fix it and wanted to have some context over it. It would be great if someone can help me with this issue, will really appreciate it. :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.