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

[Derived Fields] PR4: Capability to define derived fields in search request #12850

Merged
merged 14 commits into from
Apr 11, 2024

Conversation

rishabhmaurya
Copy link
Contributor

@rishabhmaurya rishabhmaurya commented Mar 22, 2024

Description

Adds following capability to derived fields -

  1. Define derived fields in search request -
    There are 2 ways to add derived fields to search path - a) Programatically using a rest client (which makes use of DerivedField class and adding to it SearchSourceBuilder ) b) through http request, which relies on document parsing. Thus you will see logic for both in SearchSourceBuilder. Given, we don't have access to mapper service in these classes, its not possible to create a derived field mapper and type in SearchSourceBuilder, thus they are used and are created in SearchService and injected into QueryShardContext. Once available in QueryShardContext, these derived fields mappers from search request can be used in different phases of the query.
  2. Support in fetch phase.
  3. Support highlighting on derived fields.
  4. Fixes the bug for geo_point related to geo shape query execution failure.
  5. Add integration tests for all supported types for both single and multi-valued case.
  6. Code refactor such as DerivedFieldValueFetcher now exposes 2 methods to fetch value - valueForDisplay (used by fetch and highlight phase) and value used by lucene memory index for querying purpose.

This PR is on top of - #12746, #12808, #12569, #12837

TODO

  • add support in inner hits

Related Issues

Resolves #12508

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request Search Search query, autocomplete ...etc labels Mar 22, 2024
Copy link
Contributor

github-actions bot commented Mar 22, 2024

Compatibility status:

Checks if related components are compatible with change dd4ca2a

Incompatible components

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/flow-framework.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/sql.git]

Copy link
Contributor

❌ Gradle check result for e538d96: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 10c8b03: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 64b7534: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 18ba1c2: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for b8a7b12: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@rishabhmaurya rishabhmaurya force-pushed the derived-field-pr4 branch 2 times, most recently from 34c5a5f to f706aa3 Compare April 2, 2024 20:15
Copy link
Contributor

github-actions bot commented Apr 2, 2024

❌ Gradle check result for 34c5a5f: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 2, 2024

❌ Gradle check result for f706aa3: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for 92b557c: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for f48357e: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for 57c62bd: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for faaae0e: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for d885872: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for a25b8b8: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 4, 2024

❌ Gradle check result for ef24c12: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@rishabhmaurya rishabhmaurya force-pushed the derived-field-pr4 branch 2 times, most recently from abbc52d to 5e33217 Compare April 5, 2024 04:23
Copy link
Contributor

github-actions bot commented Apr 5, 2024

❌ Gradle check result for 3165945: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 5, 2024

❌ Gradle check result for abbc52d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Apr 5, 2024

❌ Gradle check result for 5e33217: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for df047ed: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for ef7e859: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

❌ Gradle check result for 81ee8e9: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

* adds support for fetch phase on derived fields
* adds support for highligting on derived fields

Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
* fix the MockScriptEngine for derived field script
* fix the geo_point derived field type

Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Rishabh Maurya <[email protected]>
Copy link
Contributor

❌ Gradle check result for dd4ca2a: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for dd4ca2a: SUCCESS

@msfroh msfroh merged commit 645b1f1 into opensearch-project:main Apr 11, 2024
31 checks passed
@msfroh msfroh added the backport 2.x Backport to 2.x branch label Apr 11, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 11, 2024
…equest (#12850)

* Support derived fields definition in search request
* adds support for fetch phase on derived fields
* adds support for highlighting on derived fields

---------

Signed-off-by: Rishabh Maurya <[email protected]>
(cherry picked from commit 645b1f1)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…equest (opensearch-project#12850)

* Support derived fields definition in search request
* adds support for fetch phase on derived fields
* adds support for highlighting on derived fields

---------

Signed-off-by: Rishabh Maurya <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch enhancement Enhancement or improvement to existing feature or request Search Search query, autocomplete ...etc skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Derived Fields] Add basic query support with derived fields
2 participants