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

[Connector API] Bugfix: support list type in filtering advanced snippet value #105633

Conversation

jedrazb
Copy link
Member

@jedrazb jedrazb commented Feb 19, 2024

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

  • manual tests
  • unit tests
  • e2e tests

@jedrazb jedrazb added >bug auto-backport-and-merge Automatically create backport pull requests and merge when ready :EnterpriseSearch/Application Enterprise Search Team:Enterprise Search Meta label for Enterprise Search team v8.13.0 v8.14.0 labels Feb 19, 2024
@jedrazb jedrazb changed the title [Connector API] Support list types in filtering advenced snippet value [Connector API] Support list type in filtering advenced snippet value Feb 19, 2024
@jedrazb jedrazb changed the title [Connector API] Support list type in filtering advenced snippet value [Connector API] Bugfix: support list type in filtering advenced snippet value Feb 19, 2024
@jedrazb jedrazb marked this pull request as ready for review February 19, 2024 16:57
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ent-search-eng (Team:Enterprise Search)

@elasticsearchmachine
Copy link
Collaborator

Hi @jedrazb, I've created a changelog YAML for you.

@geekpete geekpete changed the title [Connector API] Bugfix: support list type in filtering advenced snippet value [Connector API] Bugfix: support list type in filtering advanced snippet value Feb 20, 2024
@jedrazb
Copy link
Member Author

jedrazb commented Feb 20, 2024

@elasticsearchmachine run buildkite/docs-build-pr

Copy link
Contributor

@timgrein timgrein left a 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 :)

@@ -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:
Copy link
Contributor

@timgrein timgrein Feb 20, 2024

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.

Copy link
Member Author

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 {
Copy link
Contributor

@timgrein timgrein Feb 20, 2024

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>
@jedrazb jedrazb removed the v8.12.0 label Feb 20, 2024
@jedrazb jedrazb merged commit b6c3cef into elastic:main Feb 20, 2024
14 checks passed
jedrazb added a commit to jedrazb/elasticsearch that referenced this pull request Feb 20, 2024
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready >bug :EnterpriseSearch/Application Enterprise Search Team:Enterprise Search Meta label for Enterprise Search team v8.13.0 v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elasticsearch Connector API Throws x_content_parse_exception on Valid Advanced Sync Rules Configuration
3 participants