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

[Backport 2.x] Add FlatObject FieldMapper #7052

Merged
merged 1 commit into from
Apr 10, 2023
Merged

Conversation

opensearch-trigger-bot[bot]
Copy link
Contributor

Backport 75bb3ef from #6507.

* Add FlatObject FieldMapper

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* resolve import package for HttpHost

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Dynamic Create FlatObjectFieldType for dotpath field

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Rename flat-object to flat_object and fix CI tests

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Organized package

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* resolved compile error

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* organize package

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Add integration tests and remove benchmark

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* fix IT tests

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Skip IT tests before 2.7.0

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Revert "Skip IT tests before 2.7.0"

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Add more IT tests for supported queries

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Removed license head and add tests for wildcard query

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Add tests for array, nested-arrary, number and float

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Upgrade FlatObjectFieldMapperTests to  MapperTestCase

- Upgrading `FlatObjectFieldMapperTests` from `MapperServiceTestCase` to `MapperTestCase`. The `MapperTestCase` explicitly forces us to:
	- Test parameter updates (empty now)
	- Explicitly specify if the field supports Meta and Boost (if not, relevant tests are automatically skipped)
- Test also the substring fields
- Add new test `testMapperServiceHasParser` to verify the new `flat_object` field mapper is present in mapper service registry
- Remove duplicated test and assertions methods
- Removed `testExistsQueryDocValuesDisabledWithNorms` as this test was not adding much. We shall reintroduce similar test later if we decide that we want to support ExistsQuery and what to do if DocValue are disabled and Norms enabled.

Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>

* Add exist query in FlatObjectFieldMapperTests and FlatObjectFieldDataTests

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Add IT tests for painless query in testDocValues

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Add filter script (Painless) test for flat_object

While it is not possible to use flat_object field in scripting filter context to access doc values (like `doc[<flat_object>.<field_x>]`) it is possible to call `doc[<flat_object>].size()` to get number of fields inside the flat_object field.

- Reorganize flat_object yaml tests into sections:
  - Mappings
  - Supported
  - Unsupported
- Scripting (Painless) yamlRest tests need to go into lang-painless module

Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>

* Removed Normalizer

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* removed unused codes

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* Remove non-relevant Javadoc from DynamicKeyFieldMapper

Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>

* Improve flat_object scripting test

Make it more obvious what the `doc[<flat_field>].size()` number represents.

Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>

* Add test for mapping parameters

Mapping parameters are not allowed in the initial version. This commit adds a test to demonstrate that trying to specify index/search analyzer for the flat_object field will fail.

Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>

* remove IndexAnalyzer from Builder

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

* remove IndexAnalyzer from Builder

Signed-off-by: Mingshi Liu <mingshl@amazon.com>

---------

Signed-off-by: Mingshi Liu <mingshl@amazon.com>
Signed-off-by: Lukáš Vlček <lukas.vlcek@aiven.io>
Co-authored-by: Lukáš Vlček <lukas.vlcek@aiven.io>
(cherry picked from commit 75bb3ef)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.indices.replication.SegmentReplicationIT.testPitCreatedOnReplica

@codecov-commenter
Copy link

Codecov Report

Merging #7052 (b3b1ffa) into 2.x (eb4940d) will decrease coverage by 0.09%.
The diff coverage is 44.57%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##                2.x    #7052      +/-   ##
============================================
- Coverage     70.36%   70.28%   -0.09%     
+ Complexity    59577    59494      -83     
============================================
  Files          4822     4824       +2     
  Lines        285929   286277     +348     
  Branches      41558    41621      +63     
============================================
+ Hits         201200   201207       +7     
- Misses        67968    68249     +281     
- Partials      16761    16821      +60     
Impacted Files Coverage Δ
...org/opensearch/cluster/metadata/IndexMetadata.java 83.11% <ø> (-0.02%) ⬇️
...rg/opensearch/common/settings/ClusterSettings.java 92.50% <ø> (ø)
...pensearch/common/settings/FeatureFlagSettings.java 50.00% <ø> (ø)
.../main/java/org/opensearch/index/IndexSettings.java 86.12% <0.00%> (ø)
...opensearch/index/mapper/DynamicKeyFieldMapper.java 100.00% <ø> (+100.00%) ⬆️
...opensearch/index/mapper/FlatObjectFieldMapper.java 44.19% <44.19%> (ø)
...ch/common/xcontent/JsonToStringXContentParser.java 45.00% <45.00%> (ø)
.../java/org/opensearch/common/util/FeatureFlags.java 90.90% <100.00%> (+0.90%) ⬆️
...ain/java/org/opensearch/indices/IndicesModule.java 96.42% <100.00%> (+0.03%) ⬆️

... and 456 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tlfeng tlfeng added backport PRs or issues specific to backporting features or enhancments Search Search query, autocomplete ...etc v2.7.0 labels Apr 7, 2023
Copy link
Collaborator

@tlfeng tlfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reminder that a separate PR needed to change the condition for running the rest api test, for main branch, and then backport that to 2.x branch.

"Flat-object fields from within the scripting":
  - skip:
      version: " - 2.6.99"
      reason: "flat_object is introduced in 2.7.0"

@tlfeng tlfeng merged commit 19e66c6 into 2.x Apr 10, 2023
@github-actions github-actions bot deleted the backport/backport-6507-to-2.x branch April 10, 2023 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport PRs or issues specific to backporting features or enhancments Search Search query, autocomplete ...etc v2.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants