Skip to content

fix(elasticsearch): fix filtering on nested fields #5643

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
wants to merge 3 commits into from

Conversation

colinodell
Copy link
Contributor

@colinodell colinodell commented Jun 29, 2023

Q A
Branch? 3.1
Tickets api-platform/api-platform/issues/1375 and #5642
License MIT
Doc PR n/a

This PR implements the following changes to support filtering on paths like foo.bar.baz:

  1. If foo is an object, isNestedField() now returns true instead of false
  2. If foo is an object, getNestedFieldPath() now returns "foo.bar" instead of null
  3. If foo is a collection, getNestedFieldPath() now returns "foo.bar" instead of just "foo" (matching the behavior if foo is an object)

As a result, filtering on deeply-nested paths (with 3 or more levels) now produces the following query:

 {
     "nested": {
-        "path": "foo",
+        "path": "foo.bar",
         "query": {
             "term": {"foo.bar.baz": "qux"}
            }
         }
     }
 }

@colinodell colinodell force-pushed the fix-nested-fields-3.1 branch from 033e096 to 80af82e Compare June 29, 2023 14:27
@soyuka
Copy link
Member

soyuka commented Jun 30, 2023

nice please target main as it's a new feature right?

@stale
Copy link

stale bot commented Aug 29, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

Successfully merging this pull request may close these issues.

2 participants