Skip to content

Conversation

@jpountz
Copy link
Contributor

@jpountz jpountz commented Mar 2, 2020

This field is a specialization of the keyword field for the case when all
documents have the same value. It typically performs more efficiently than
keywords at query time by figuring out whether all or none of the documents
match at rewrite time, like term queries on _index.

The name is up for discussion. I liked including keyword in it, so that we
still have room for a singleton_numeric in the future. However I'm unsure
whether to call it singleton, constant or something else, any opinions?

For this field there is a choice between

  1. accepting values in _source when they are equal to the value configured
    in mappings, but rejecting mapping updates
  2. rejecting values in _source but then allowing updates to the value that
    is configured in the mapping
    This commit implements option 1, so that it is possible to reindex from/to an
    index that has the field mapped as a keyword with no changes to the source.

Backport of #49713

This field is a specialization of the `keyword` field for the case when all
documents have the same value. It typically performs more efficiently than
keywords at query time by figuring out whether all or none of the documents
match at rewrite time, like `term` queries on `_index`.

The name is up for discussion. I liked including `keyword` in it, so that we
still have room for a `singleton_numeric` in the future. However I'm unsure
whether to call it `singleton`, `constant` or something else, any opinions?

For this field there is a choice between
 1. accepting values in `_source` when they are equal to the value configured
    in mappings, but rejecting mapping updates
 2. rejecting values in `_source` but then allowing updates to the value that
    is configured in the mapping
This commit implements option 1, so that it is possible to reindex from/to an
index that has the field mapped as a keyword with no changes to the source.

Backport of elastic#49713
@jpountz jpountz added :Search Foundations/Mapping Index mappings, including merging and defining field types backport labels Mar 2, 2020
@elasticmachine
Copy link
Collaborator

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

@jpountz jpountz merged commit cb868d2 into elastic:7.x Mar 3, 2020
@jpountz jpountz deleted the backport/49713 branch March 3, 2020 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Search Foundations/Mapping Index mappings, including merging and defining field types

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants