Skip to content

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

Closed
colinodell wants to merge 3 commits into
api-platform:3.1from
colinodell:fix-nested-fields-3.1
Closed

fix(elasticsearch): fix filtering on nested fields#5643
colinodell wants to merge 3 commits into
api-platform:3.1from
colinodell:fix-nested-fields-3.1

Conversation

@colinodell

@colinodellcolinodell commented Jun 29, 2023

Copy link
Copy Markdown
Contributor
QA
Branch?3.1
Tickets#7997 and #5642
LicenseMIT
Doc PRn/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
colinodellforce-pushed the fix-nested-fields-3.1 branch from 033e096 to 80af82eCompareJune 29, 2023 14:27
@soyuka

Copy link
Copy Markdown
Member

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

@stale

staleBot commented Aug 29, 2023

Copy link
Copy Markdown

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 freeto 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

@colinodell@soyuka