Skip to content

Allow docvalues-only search on geo_shape #94396

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

Merged
merged 4 commits into from
Mar 8, 2023

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Mar 8, 2023

Similar to #82409, this allows searching on a geo_shape field type when the field is not indexed (index: false) but just doc values are enabled.

@iverase iverase added >enhancement :Analytics/Geo Indexing, search aggregations of geo points and shapes v8.8.0 labels Mar 8, 2023
@iverase iverase requested a review from craigtaverner March 8, 2023 13:20
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Documentation preview:

@elasticsearchmachine
Copy link
Collaborator

Hi @iverase, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Mar 8, 2023
Copy link
Contributor

@craigtaverner craigtaverner left a comment

Choose a reason for hiding this comment

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

LGTM. I did have comments, but I think they answered themselves.

final Query queryDocValues = new LatLonShapeDocValuesQuery(fieldName, relation.getLuceneRelation(), geometries);
query = new IndexOrDocValuesQuery(query, queryDocValues);
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if both indexed and docValues are false? Or perhaps that combination is disallowed? The docs you added do not specify that at least one needs to be positive.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking more carefully I see that null will be returned as the query, so perhaps this case is handled by the caller?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This case is handle by failIfNotIndexedNorDocValuesFallback(context);

Fields that only have <<doc-values,`doc_values`>> enabled can still be queried, albeit slower.
| `true`

|`doc_values` |Should the field be stored on disk in a column-stride fashion,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can both index and doc_values be set to false?

- match: {error.reason: "all shards failed"}
- match: {error.phase: query}
- match: {error.failed_shards.0.reason.type: query_shard_exception}
- match: {error.failed_shards.0.reason.reason: "failed to create query: Cannot search on field [no_doc_values_no_index] since it is not indexed nor has doc values."}
Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I see there is already error handling for the case I was worried about above. Perhaps a comment in the docs is a good idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something generic and I don't think we should explicitly document it on this field mapping.

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 >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants