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
[Connector API] Bugfix: support list type in filtering advanced snippet value #105633
[Connector API] Bugfix: support list type in filtering advanced snippet value #105633
Conversation
Pinging @elastic/ent-search-eng (Team:Enterprise Search) |
Hi @jedrazb, I've created a changelog YAML for you. |
@elasticsearchmachine run buildkite/docs-build-pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I left some suggestions around the tests, but as you're on SDH I can also take these suggestions and provide a follow-up after your merge today :)
...n/java/org/elasticsearch/xpack/application/connector/filtering/FilteringAdvancedSnippet.java
Outdated
Show resolved
Hide resolved
@@ -41,7 +44,13 @@ setup: | |||
advanced_snippet: | |||
created_at: "2023-05-25T12:30:00.000Z" | |||
updated_at: "2023-05-25T12:30:00.000Z" | |||
value: {} | |||
value: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add one additional test, which tests that parsing an object to a map with actual values works? I think we only have empty objects like value: {}
in this integration test. It could also make sense to separate the tests to Update Connector Filtering with advanced snippet value array
, Update Connector Filtering with advanced snippet value object
, Update Connector Filtering with advanced snippet value literal
(failing test), but this is just a personal opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add it in followup PR, I want to get this merged before next BC
@@ -110,6 +110,73 @@ public void testToXContent() throws IOException { | |||
|
|||
} | |||
|
|||
public void testToXContent_WithAdvancedSnippetPopulated() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar suggestion to the one in the integration tests. Should we've explicit test for the different cases: literal (failing), object and array?
…/application/connector/filtering/FilteringAdvancedSnippet.java Co-authored-by: Tim Grein <tim@4greins.de>
💚 Backport successful
|
Bug description
Filtering advanced snippet value can be array of objects (instead of just an object). This is expected by current implementation of the Connector framework. If connector uses advanced filtering, then the parser can break when reading connector data (sync start)
Changes
Adapt parser logic to support list-type as filtering advanced snippet value.
Verficiation