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

Add a soft limit for the number of requested doc-value fields #26574

Merged
merged 2 commits into from
Sep 13, 2017

Conversation

cbuescher
Copy link
Member

Requesting to many docvalue_fields in a search request can potentially be costly
because it might incur a per-field per-document seek. This change introduces a
soft limit on the number of fields that can be retrieved. The setting can be
changed per index using the index.max_docvalue_fields_search setting.

Relates to #26390

@cbuescher cbuescher requested a review from jpountz September 11, 2017 12:54
@cbuescher
Copy link
Member Author

@jpountz since you opened #26390, would you mind taking a look? I put 100 as a default value as a start but maybe thats too low, wdyt.

@cbuescher cbuescher added :Search/Search Search-related issues that do not fall into other categories >enhancement review v6.0.0 v6.1.0 v7.0.0 labels Sep 11, 2017
@nik9000
Copy link
Member

nik9000 commented Sep 11, 2017

100

Seems fine to me, especially for a soft limit.

@cbuescher cbuescher force-pushed the fix-softLimitDocValueFields branch from 697f56d to e1fb5cd Compare September 11, 2017 13:43
Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

LGTM. 100 sounds like a good start to me.

Requesting to many docvalue_fields in a search request can potentially be costly
because it might incur a per-field per-document seek. This change introduces a
soft limit on the number of fields that can be retrieved. The setting can be
changed per index using the `index.max_docvalue_fields_search` setting.

Relates to elastic#26390
@cbuescher cbuescher force-pushed the fix-softLimitDocValueFields branch from e1fb5cd to 3ad15f1 Compare September 11, 2017 14:49
@cbuescher
Copy link
Member Author

@nik9000, @jpountz thanks, one last question: I saw other changes concerning soft limits related to #11511 were merged to 7.0 and 6.1.0, I wonder if we should also merge these (and this PR) to 6.0.0, otherwise we change behaviour (potentially throwing an error) on a minor version. Wdyt?

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

I left one thing for discussion. Otherwise it LGTM.

* doc values might incur a per-field per-document seek.
*/
public static final Setting<Integer> MAX_DOCVALUE_FIELDS_SEARCH_SETTING =
Setting.intSetting("index.max_docvalue_fields_search", 100, 1, Property.Dynamic, Property.IndexScope);
Copy link
Member

Choose a reason for hiding this comment

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

I think 0 is a good minimum value.

int maxAllowedDocvalueFields = context.mapperService().getIndexSettings().getMaxDocvalueFields();
if (source.docValueFields().size() > maxAllowedDocvalueFields) {
throw new IllegalArgumentException(
"Trying to retrieve too many docvalue_fields. " + "Must be less than or equal to: [" + maxAllowedDocvalueFields
Copy link
Member

Choose a reason for hiding this comment

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

Extra " + " I think.

@cbuescher cbuescher merged commit e00db23 into elastic:master Sep 13, 2017
cbuescher added a commit that referenced this pull request Sep 13, 2017
Requesting to many docvalue_fields in a search request can potentially be costly
because it might incur a per-field per-document seek. This change introduces a
soft limit on the number of fields that can be retrieved. The setting can be
changed per index using the `index.max_docvalue_fields_search` setting.

Relates to #26390
cbuescher added a commit that referenced this pull request Sep 13, 2017
Requesting to many docvalue_fields in a search request can potentially be costly
because it might incur a per-field per-document seek. This change introduces a
soft limit on the number of fields that can be retrieved. The setting can be
changed per index using the `index.max_docvalue_fields_search` setting.

Relates to #26390
cbuescher added a commit that referenced this pull request Sep 13, 2017
After backporting the related change to the 6.x branches, this test can now also
be run in a mixed cluster.

Relates to #26574
jasontedor added a commit to jpountz/elasticsearch that referenced this pull request Sep 13, 2017
* master: (21 commits)
  Ensure module is bundled before installing in tests
  Add boolean similarity to built in similarity types (elastic#26613)
  [Tests] Remove skip tests in search/30_limits.yml
  Let search phases override max concurrent requests
  Add a soft limit for the number of requested doc-value fields (elastic#26574)
  Support for accessing Azure repositories through a proxy (elastic#23518)
  Add beta tag to MSI Windows Installer (elastic#26616)
  Fix Lucene version of 5.6.1.
  Remove azure deprecated settings (elastic#26099)
  Handle the 5.6.0 release
  Allow plugins to validate cluster-state on join (elastic#26595)
  Remove index mapper dynamic settings (elastic#25734)
  update AWS SDK for ECS Task IAM support in discovery-ec2 (elastic#26479)
  Azure repository: Accelerate the listing of files (used in delete snapshot) (elastic#25710)
  Build: Remove norelease from forbidden patterns (elastic#26592)
  Fix reference to painless inside expression engine (elastic#26528)
  Build: Move javadoc linking to root build.gradle (elastic#26529)
  Test: Remove leftover static bwc test case (elastic#26584)
  Docs: Remove remaining references to file and native scripts (elastic#26580)
  Snapshot fallback should consider build.snapshot
  ...
jasontedor added a commit to synhershko/elasticsearch that referenced this pull request Sep 14, 2017
* master: (39 commits)
  [Docs] Correct typo in removal_of_types.asciidoc (elastic#26646)
  [Docs] "The the" is a great band, but ... (elastic#26644)
  Move all repository-azure classes under one single package (elastic#26624)
  [Docs] Update link in removal_of_types.asciidoc (elastic#26614)
  Fix percolator highlight sub fetch phase to not highlight query twice (elastic#26622)
  Refactor bootstrap check results and error messages
  Add BootstrapContext to expose settings and recovered state to bootstrap checks (elastic#26628)
  [Tests] Removing skipping tests in search rest tests
  Initialize checkpoint tracker with allocation ID
  Move non-core mappers to a module. (elastic#26549)
  [Docs] Clarify size parameter in Completion Suggester doc (elastic#26617)
  Add soft limit on allowed number of script fields in request (elastic#26598)
  Remove MapperService#dynamic. (elastic#26603)
  Fix incomplete sentences in parent-join docs (elastic#26623)
  More efficient encoding of range fields. (elastic#26470)
  Ensure module is bundled before installing in tests
  Add boolean similarity to built in similarity types (elastic#26613)
  [Tests] Remove skip tests in search/30_limits.yml
  Let search phases override max concurrent requests
  Add a soft limit for the number of requested doc-value fields (elastic#26574)
  ...
@lcawl lcawl removed the v6.1.0 label Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v6.0.0-rc1 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants