Skip to content

_type not using doc_values in ES 2.0 #14781

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

Closed
ppf2 opened this issue Nov 16, 2015 · 1 comment · Fixed by #14783
Closed

_type not using doc_values in ES 2.0 #14781

ppf2 opened this issue Nov 16, 2015 · 1 comment · Fixed by #14783
Labels

Comments

@ppf2
Copy link
Member

ppf2 commented Nov 16, 2015

POST /_cache/clear
DELETE testfd
POST testfd/type/1
{
  "test":"test"
}
GET testfd/_search
{
  "size": 0, 
  "aggs": {
    "NAME": {
      "terms": {
        "field": "_type",
        "size": 10
      }
    }
  }
}

GET /_cat/fielddata?v

Testing on ES 1.7 and ES 2.0, the above loads the same amount of fielddata into the fd cache.

On ES 1.7, put mapping api's change of _type to use doc_values or disable fd options do not throw an error, but they are not honored.

On ES 2.0, we explicitly throw an error when someone tries to modify the _type. However, it also appears that we do not use doc_values for _type by default in ES 2.0.

If this is the expected behavior, it will be nice to document accordingly. We do have use cases in the field where users are aggregating against the _type field. Workaround is to tag each document with a custom "type" field and educate users to aggregate against this field instead of _type, though it will be helpful to provide a way to disable fielddata loading for _type as well.

@ppf2 ppf2 added the discuss label Nov 16, 2015
@pickypg
Copy link
Member

pickypg commented Nov 16, 2015

A workaround to this problem is to not use _type at all. Have a single _type and add another field that represents the "type" of a document, then work against it. This has the added benefit that it simplifies the mapping.

rjernst added a commit to rjernst/elasticsearch that referenced this issue Nov 16, 2015
_type should have got doc values with the change to default doc values.
However, due to how metadata fields have separate builders and special
constructors, it was not picking it up. This change updates the field
type for _type to have doc values.

closes elastic#14781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants