Don't index the `_version` field (#20132)

The `_version` field doesn't allow to be searched anyway since it's
set `IndexOptions#NONE` for it instead.
This commit is contained in:
Simon Willnauer 2016-08-24 10:04:27 +02:00 committed by GitHub
parent 5d6c9b0745
commit 1b1a1acad8
1 changed files with 2 additions and 0 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.index.mapper;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.search.Query;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -47,6 +48,7 @@ public class VersionFieldMapper extends MetadataFieldMapper {
static {
FIELD_TYPE.setName(NAME);
FIELD_TYPE.setDocValuesType(DocValuesType.NUMERIC);
FIELD_TYPE.setIndexOptions(IndexOptions.NONE);
FIELD_TYPE.setHasDocValues(true);
FIELD_TYPE.freeze();
}