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

Enforce Completion Context Limit #38675

Merged
merged 8 commits into from
Feb 18, 2019
Merged

Enforce Completion Context Limit #38675

merged 8 commits into from
Feb 18, 2019

Conversation

TommyWind
Copy link
Contributor

@elasticcla
Copy link

Hi @TommyWind, we have found your signature in our records, but it seems like you have signed with a different e-mail than the one used in yout Git commit. Can you please add both of these e-mails into your Github profile (they can be hidden), so we can match your e-mails to your Github profile?

* Enforcing a maximum number of completion contexts as reqested in elastic#32741
* Closes elastic#32741
@matriv matriv added the :Search/Search Search-related issues that do not fall into other categories label Feb 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks @TommyWind , I left a comment regarding where to check the limit.

@@ -497,6 +500,7 @@ static void validateTypeName(String type) {
ContextMapping.validateContextPaths(indexSettings.getIndexVersionCreated(), fieldMappers, fieldTypes::get);

if (reason == MergeReason.MAPPING_UPDATE) {
checkCompletionContextsLimit(fieldMappers);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be easier to perform the check directly in CompletionFieldMapper#Builder#build since you have all the needed informations there. We should also not throw an error on old indices (created before 780) since they were created before this breaking change. You can check the created version of the index in the CompletionFieldMapper with BuilderContext#indexCreatedVersion and throw an error if the index has been created on or after 8.0 and a deprecation warning otherwise.

@TommyWind
Copy link
Contributor Author

@jimczi thanks for taking a look. :) Moved the logic the way you suggested. Could you take another look please?

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks @TommyWind , the change looks good. Can you add a small note in the docs regarding the new limit?:
https://github.com/elastic/elasticsearch/blob/master/docs/reference/search/suggesters/context-suggest.asciidoc

@TommyWind
Copy link
Contributor Author

@jimczi thanks, I added a note to the docs. Please take a look when you have some time. :)

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks for updating @TommyWind . I'll run the tests in our CI and I'll merge your pr if they pass.

@jimczi
Copy link
Contributor

jimczi commented Feb 13, 2019

@elasticmachine test this please

@TommyWind
Copy link
Contributor Author

@jimczi Thanks :)

@TommyWind
Copy link
Contributor Author

TommyWind commented Feb 15, 2019 via email

@jimczi
Copy link
Contributor

jimczi commented Feb 18, 2019

@elasticmachine test this please

@jimczi jimczi merged commit c1ab821 into elastic:master Feb 18, 2019
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Feb 18, 2019
…ate-file

* elastic/master:
  Remove tests and branches that will never execute (elastic#38772)
  also check ccr stats api return empty response in ensureNoCcrTasks()
  Add overlapping, before, after filters to intervals query (elastic#38999)
  Mute test elastic#38949
  Add remote recovery to ShardFollowTaskReplicationTests (elastic#39007)
  [ML] More advanced post-test cleanup of ML indices (elastic#39049)
  wait for shard to be allocated before executing a resume follow api
  Update track-total-hits.asciidoc
  Force kill testcluster nodes (elastic#37353)
  Make pullFixture a task dependency of resolveAllDependencies (elastic#38956)
  set minimum supported version (elastic#39043)
  Enforce Completion Context Limit (elastic#38675)
  Mute test
  Don't close caches while there might still be in-flight requests. (elastic#38958)
  Fix elastic#38623 remove xpack namespace REST API (elastic#38625)
  Add data frame feature (elastic#38934)
  Test bi-directional index following during a rolling upgrade. (elastic#38962)
  Generate mvn pom for ssl-config library (elastic#39019)
  Mute testRetentionLeaseIsRenewedDuringRecovery
jimczi pushed a commit to jimczi/elasticsearch that referenced this pull request Feb 18, 2019
This change adds a limit to the number of completion contexts that a completion field can define.

Closes elastic#32741
@jimczi jimczi added :Search Foundations/Mapping Index mappings, including merging and defining field types and removed :Search/Search Search-related issues that do not fall into other categories labels Feb 18, 2019
jimczi added a commit that referenced this pull request Feb 19, 2019
This change adds a limit to the number of completion contexts that a completion field can define.

Closes #32741
javanna added a commit to javanna/elasticsearch that referenced this pull request Sep 17, 2024
We have version based logic that applies the limit to number of completion contexts
only to indices created from 8.0 on. Those are the only indices we can now have
in a cluster, hence we can remove the version based conditional.

Relates to elastic#38675
javanna added a commit to javanna/elasticsearch that referenced this pull request Sep 18, 2024
We have version based logic that applies the limit to number of completion contexts
only to indices created from 8.0 on. Those are the only indices we can now have
in a cluster, hence we can remove the version based conditional.

Relates to elastic#38675
javanna added a commit that referenced this pull request Sep 18, 2024
We have version based logic that applies the limit to number of completion contexts
only to indices created from 8.0 on. Those are the only indices we can now have
in a cluster, hence we can remove the version based conditional.

Relates to #38675
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking >enhancement :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.

Limit the number of context mappings
6 participants