-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 cluster setting to disallow loading fielddata on _id field #49166
Conversation
Pinging @elastic/es-search (:Search/Mapping) |
e85c14e
to
cf6d8ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this longstanding issue!
server/src/main/java/org/elasticsearch/index/mapper/IdFieldMapper.java
Outdated
Show resolved
Hide resolved
@@ -142,9 +143,18 @@ | |||
|
|||
final MapperRegistry mapperRegistry; | |||
|
|||
private final BooleanSupplier idFieldDataEnabled; | |||
|
|||
public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, NamedXContentRegistry xContentRegistry, | |||
SimilarityService similarityService, MapperRegistry mapperRegistry, | |||
Supplier<QueryShardContext> queryShardContextSupplier) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this constructor and change callers to pass () -> false
, e.g. in tests?
@@ -168,6 +169,9 @@ | |||
public static final String INDICES_SHARDS_CLOSED_TIMEOUT = "indices.shards_closed_timeout"; | |||
public static final Setting<TimeValue> INDICES_CACHE_CLEAN_INTERVAL_SETTING = | |||
Setting.positiveTimeSetting("indices.cache.cleanup_interval", TimeValue.timeValueMinutes(1), Property.NodeScope); | |||
public static final Setting<Boolean> INDICES_ID_FIELD_DATA_ENABLED_SETTING = | |||
Setting.boolSetting("indices.id_field_data.enabled", false, Property.Dynamic, Property.NodeScope); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I understand correctly, the default will become true upon backport?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's the plan
This is amazing! I can really use this.. I have users that accidentally try to aggregate on _id, and it destroys my memory.. 1.5gb used until I clear the cache for it. |
This change adds a dynamic cluster setting named `indices.id_field_data.enabled`. When set to `false` any attempt to load the fielddata for the `_id` field will fail with an exception. The default value in this change is set to `false` in order to prevent fielddata usage on this field for future versions but it will be set to `true` when backporting to 7x. When the setting is set to true (manually or by default in 7x) the loading will also issue a deprecation warning since we want to disallow fielddata entirely when elastic#26472 is implemented. Closes elastic#43599
…per.java Rewording Co-Authored-By: Adrien Grand <jpountz@gmail.com>
30844dd
to
e8aa2c4
Compare
The test was slightly modified with elastic#49166, the two test documents in `testNormalization` look like they should mirror the document id in the "id" field in order for it to work as a tie breaker. Closes elastic#49654
) This change adds a dynamic cluster setting named `indices.id_field_data.enabled`. When set to `false` any attempt to load the fielddata for the `_id` field will fail with an exception. The default value in this change is set to `false` in order to prevent fielddata usage on this field for future versions but it will be set to `true` when backporting to 7x. When the setting is set to true (manually or by default in 7x) the loading will also issue a deprecation warning since we want to disallow fielddata entirely when #26472 is implemented. Closes #43599
as of elastic/elasticsearch#49166 it is disabled by default. The kibana task manager is upset about thi so reenable globally for now.
@jimczi , shouldn't we add the new setting in this document as a reference? https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html It's the doc where we recommend against sorting or aggregating towards
|
Would be awesome to backport this to 6.8 |
Sorry @nezda but we won’t backport this to 6.8 because our policy is that we don’t add new features to versions in maintenance mode. |
There are no reference docs on our site about this setting |
This change adds a dynamic cluster setting named
indices.id_field_data.enabled
.When set to
false
any attempt to load the fielddata for the_id
field will failwith an exception. The default value in this change is set to
false
in order to preventfielddata usage on this field for future versions but it will be set to
true
when backportingto 7x. When the setting is set to true (manually or by default in 7x) the loading will also issue
a deprecation warning since we want to disallow fielddata entirely when #26472 is implemented.
Closes #43599