python - Create term query on field contained in another field with elasticsearch-dsl-py -
i using elasticsearch-dsl-py , filter on term contained inside 1 this:
"slug": { "foo": "foo-slug", "bar": "bar-slug " }
what :
search.query(‘filtered’, filter={"term": {"slug.foo": "foo-slug"}})
i prefer
search.filter(term, slug.foo="foo-slug")
but can’t keyword can’t include dots.
if helps else, had same problem creating kind of query against child property not using nested objects. found solution use query
method instead of filter
method:
search.query('match', **{"slug.foo": "foo-slug"})
this worked me in elasticsearch 1.5.2.
Comments
Post a Comment