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

Fix merging of search_as_you_type field mapper #40593

Merged
merged 2 commits into from
Mar 29, 2019

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Mar 28, 2019

The merge of the search_as_you_type field mapper uses the wrong prefix field
and does not update the underlying field types.

The merge of the `search_as_you_type` field mapper uses the wrong prefix field
and does not update the underlying field types.
@jimczi jimczi added >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.2.0 labels Mar 28, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

this.prefixField = (PrefixFieldMapper) this.prefixField.merge(mw);
if (prefixField.equals(mw.prefixField) == false) {
this.prefixField = (PrefixFieldMapper) this.prefixField.merge(mw.prefixField);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use this same logic for the shingle fields below (i.e. only merge if they're unequal)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a leftover, we should always merge, I removed the test

@@ -736,8 +748,7 @@ protected void doXContentBody(XContentBuilder builder, boolean includeDefaults,
List<Mapper> subIterators = new ArrayList<>();
subIterators.add(prefixField);
subIterators.addAll(Arrays.asList(shingleFields));
@SuppressWarnings("unchecked") Iterator<Mapper> concat = Iterators.concat(super.iterator(), subIterators.iterator());
return concat;
return Iterators.concat(super.iterator(), subIterators.iterator());
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we fail compilation on the warning from the call to Iterators.concat here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep I restored the original

Copy link
Contributor

@andyb-elastic andyb-elastic left a comment

Choose a reason for hiding this comment

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

LGTM thanks for catching this

@jimczi jimczi merged commit ae569a2 into elastic:master Mar 29, 2019
@jimczi jimczi deleted the search_as_you_type_field_merge branch March 29, 2019 08:01
jimczi added a commit that referenced this pull request Mar 29, 2019
The merge of the `search_as_you_type` field mapper uses the wrong prefix field
and does not update the underlying field types.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Mar 29, 2019
* elastic/master: (77 commits)
  Update ingest jdocs that a null return value will drop the current document. (elastic#40359)
  Remove -Xlint exclusions in the ingest-common module. (elastic#40505)
  Update docs for the DFR similarity (elastic#40579)
  Fix merging of search_as_you_type field mapper (elastic#40593)
  Support roles with application privileges against wildcard applications (elastic#40398)
  Remove obsolete security settings (elastic#40496)
  Remove Gradle deprecation warnings (elastic#40449)
  Run the build integ test in parallel (elastic#39788)
  Fix 3rd pary S3 tests (elastic#40588)
  lower bwc skip for search as you type (elastic#40599)
  Muting XContentParserTests#testSubParserArray
  Fixing typo in test error message (elastic#40611)
  Update max dims for vectors to 1024. (elastic#40597)
  Add start and stop time to cat recovery API (elastic#40378)
  [DOCS] Correct keystore commands for Email and Jira actions in Watcher (elastic#40417)
  [DOCS] Document common settings for snapshot repository plugins (elastic#40475)
  Remove with(out)-system-key tests (elastic#40547)
  Geo Point parse error fix (elastic#40447)
  Handle null retention leases in WaitForNoFollowersStep (elastic#40477)
  [DOCS] Adds anchors for ruby client (elastic#39867)
  ...
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Mar 29, 2019
* elastic/master: (129 commits)
  Update ingest jdocs that a null return value will drop the current document. (elastic#40359)
  Remove -Xlint exclusions in the ingest-common module. (elastic#40505)
  Update docs for the DFR similarity (elastic#40579)
  Fix merging of search_as_you_type field mapper (elastic#40593)
  Support roles with application privileges against wildcard applications (elastic#40398)
  Remove obsolete security settings (elastic#40496)
  Remove Gradle deprecation warnings (elastic#40449)
  Run the build integ test in parallel (elastic#39788)
  Fix 3rd pary S3 tests (elastic#40588)
  lower bwc skip for search as you type (elastic#40599)
  Muting XContentParserTests#testSubParserArray
  Fixing typo in test error message (elastic#40611)
  Update max dims for vectors to 1024. (elastic#40597)
  Add start and stop time to cat recovery API (elastic#40378)
  [DOCS] Correct keystore commands for Email and Jira actions in Watcher (elastic#40417)
  [DOCS] Document common settings for snapshot repository plugins (elastic#40475)
  Remove with(out)-system-key tests (elastic#40547)
  Geo Point parse error fix (elastic#40447)
  Handle null retention leases in WaitForNoFollowersStep (elastic#40477)
  [DOCS] Adds anchors for ruby client (elastic#39867)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants