Skip to content
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

Unable to query for Nested non-dynamic (dynamic=False) field #1492

Closed
snyaggarwal opened this issue Mar 12, 2021 · 0 comments
Closed

Unable to query for Nested non-dynamic (dynamic=False) field #1492

snyaggarwal opened this issue Mar 12, 2021 · 0 comments

Comments

@snyaggarwal
Copy link

snyaggarwal commented Mar 12, 2021

I have an ES index with many fields, one of them is:

"extras": {
     "type": "nested",
     "dynamic": "false"
}

I want to store any random arbitrary JSON structure (schema-less) in this field.
I can create this doc and it returns a value of type elasticsearch_dsl.document.InnerDoc.

I am unable to query this.
Assuming the value of extras={'sytem': {'code': 'foo', 'valueType': 'bar'}}
Following dint work:

  1. ResourceDocument.search().filter("query_string", query="foo", fields=['extras__system__code']).execute().hits
  2. ResourceDocument.search().query(Q('nested', path='extras', query=Q('exists', field='extras.system.code'))).execute().hits
  3. ResourceDocument.search().query(Q('nested', path='extras', query=Q('exists', field='extras__system__code'))).execute().hits

Earlier I had this field dynamic=True and the following query 1 (above) was working fine. But I had to move it to dynamic=False to support schemaless JSON.

Any help would be appreciated!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants