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 doc_values mapping option to geo_shape/shape field mappers #53351

Closed
wants to merge 1 commit into from

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Mar 10, 2020

This PR adds support for the doc_values field mapping parameter.

false is currently the only supported value to explicitly
set, and is also the default.

This PR adds support for the `doc_values` field mapping parameter.

`false` is currently the only supported value to explicitly
set, and is also the default.
@talevy talevy added >non-issue :Analytics/Geo Indexing, search aggregations of geo points and shapes :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 labels Mar 10, 2020
@talevy talevy requested a review from nknize March 10, 2020 17:39
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Geo)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@@ -352,15 +373,17 @@ public QueryProcessor geometryQueryBuilder() {
protected Explicit<Boolean> coerce;
protected Explicit<Boolean> ignoreMalformed;
protected Explicit<Boolean> ignoreZValue;
protected Explicit<Boolean> docValues;
Copy link
Contributor

Choose a reason for hiding this comment

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

This one should be on the fieldType since it also affects queries and aggs. Only parameters that only affect indexing may be stored on the mapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm. I suppose that was not intuitive to me. I found the relationship between the field-mapper's Explicit values, the docValuesSet, and the FieldType's hasDocValues all to compete in responsibility in some ways.

I think I see what you mean now, I will try and update to reflect this. thanks!

protected Explicit<Boolean> docValues() {
// TODO(talevy): see how to best make this pluggable with the DataHandler work
// although these values can be true, an ElasticsearchParseException
// prevents this Explicit(true,true) path to ever occur in practice
Copy link
Contributor

Choose a reason for hiding this comment

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

One possibility would be to only enable doc values by default if there is a registered DataHandler.

@@ -399,6 +425,9 @@ public void doXContentBody(XContentBuilder builder, boolean includeDefaults, Par
if (includeDefaults || ignoreZValue.explicit()) {
builder.field(GeoPointFieldMapper.Names.IGNORE_Z_VALUE.getPreferredName(), ignoreZValue.value());
}
if (includeDefaults || docValues.explicit()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jpountz, in a follow-up commit I've removed the Explicit docValues field from the Mapper, but without it, this conditional is difficult to achieve (unless I'm missing something). It is difficult to check whether the value was set explicitly without access to docValuesSet which is in the field mapper's builder.

not sure this is a big deal, but it does feel like the doc values field should only be serialized in this scenaior

@talevy
Copy link
Contributor Author

talevy commented Mar 11, 2020

After speaking with Ryan in a video-conference, I now understand the intension of defaultDocValues and the doc_values param on field mappers better. A lot of the connection between FieldMapper.Builder and doc_values originates from when doc-values were switched to be enabled by default. This was not meant to reflect that all FieldMappers should understand and parse a doc_values field. and these doc-values are intended to be an implementation detail of the field types.

For that reason, and the reason that this setting is likely only ever allowed to be false in core, and would never be tested when set to true, I am closing this PR for further discussion on how to best extend the indexing of doc-value fields within the geo-shape field mapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >non-issue :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants