Skip to content

Terms lookup feature no longer supported due to recent release #1920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bptarpley opened this issue Oct 3, 2024 · 2 comments · Fixed by #1921
Closed

Terms lookup feature no longer supported due to recent release #1920

bptarpley opened this issue Oct 3, 2024 · 2 comments · Fixed by #1921

Comments

@bptarpley
Copy link

A recent release appears to have broken the ability to perform a "terms lookup" query which is a special subset of terms query which allows you to specify the index, id, and field so you can limit terms to those found in a specific document in another index:

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html#query-dsl-terms-lookup

I used to be able to create a "terms lookup" query like so:

Q('terms', **{'_id': {
    'index': 'my-other-index',
    'id': 'my-document-id',
    'path': 'my-field'
}})

Now, however, the query generated flattens the dictionary into a list of keys, so that what actually gets built is this:

"terms": {
    "_id": [
        "index",
        "id",
        "path"
    ]
}

This seems to be an unintended side-effect of a recent release. Please advise.

@bptarpley
Copy link
Author

I can confirm that reverting back to version 8.15.0 allows the query to be generated appropriately, i.e.:

"terms": {
    "_id": {
        "index": "my-other-index",
        "id": "my-document-id",
        "path": "my-field"
    }
}

@miguelgrinberg
Copy link
Collaborator

miguelgrinberg commented Oct 4, 2024

Yes, this is another regression introduced by #1887 in 8.15.1. There are lots of variations that were not considered. I have addressed a couple already, but missed the passing of a dict as an argument.

miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Oct 4, 2024
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Oct 7, 2024
github-actions bot pushed a commit that referenced this issue Oct 7, 2024
miguelgrinberg added a commit that referenced this issue Oct 7, 2024
Fixes #1920

(cherry picked from commit fb18f38)

Co-authored-by: Miguel Grinberg <[email protected]>
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-dsl-py that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants