Mappings: Move short name access out of field type
Eventually, the field type should not need any names, because there will be only one name which leads to finding it (the full name, which is also the index name). However, the short or "simple" name (using java terminology for class names) is needed just in a couple places, for serialization. This change moves the simple name out of MappedFieldType.Names, into Mapper, and makes Mapper and FieldMapper abstract classes.
This commit is contained in:
parent
ac8896c10e
commit
41dc1b0120
|
@ -193,13 +193,6 @@ public class TransportGetFieldMappingsIndexAction extends TransportSingleCustomO
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Iterator<FieldMapper> it = remainingFieldMappers.iterator(); it.hasNext(); ) {
|
|
||||||
final FieldMapper fieldMapper = it.next();
|
|
||||||
if (Regex.simpleMatch(field, fieldMapper.fieldType().names().shortName())) {
|
|
||||||
addFieldMapper(fieldMapper.fieldType().names().shortName(), fieldMapper, fieldMappings, request.includeDefaults());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// not a pattern
|
// not a pattern
|
||||||
|
|
|
@ -23,28 +23,27 @@ import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
public abstract class FieldMapper extends Mapper {
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface FieldMapper extends Mapper {
|
|
||||||
|
|
||||||
String DOC_VALUES_FORMAT = "doc_values_format";
|
public FieldMapper(String simpleName) {
|
||||||
|
super(simpleName);
|
||||||
|
}
|
||||||
|
|
||||||
MappedFieldType fieldType();
|
public abstract MappedFieldType fieldType();
|
||||||
|
|
||||||
/** Returns a reference to the MappedFieldType for this mapper. */
|
/** Returns a reference to the MappedFieldType for this mapper. */
|
||||||
MappedFieldTypeReference fieldTypeReference();
|
public abstract MappedFieldTypeReference fieldTypeReference();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the reference to this field's MappedFieldType.
|
* Updates the reference to this field's MappedFieldType.
|
||||||
* Implementations should assert equality of the underlying field type
|
* Implementations should assert equality of the underlying field type
|
||||||
*/
|
*/
|
||||||
void setFieldTypeReference(MappedFieldTypeReference ref);
|
public abstract void setFieldTypeReference(MappedFieldTypeReference ref);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of fields where this field should be copied to
|
* List of fields where this field should be copied to
|
||||||
*/
|
*/
|
||||||
AbstractFieldMapper.CopyTo copyTo();
|
public abstract AbstractFieldMapper.CopyTo copyTo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fields might not be available before indexing, for example _all, token_count,...
|
* Fields might not be available before indexing, for example _all, token_count,...
|
||||||
|
@ -52,13 +51,13 @@ public interface FieldMapper extends Mapper {
|
||||||
*
|
*
|
||||||
* @return If the field is available before indexing or not.
|
* @return If the field is available before indexing or not.
|
||||||
* */
|
* */
|
||||||
boolean isGenerated();
|
public abstract boolean isGenerated();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse using the provided {@link ParseContext} and return a mapping
|
* Parse using the provided {@link ParseContext} and return a mapping
|
||||||
* update if dynamic mappings modified the mappings, or {@code null} if
|
* update if dynamic mappings modified the mappings, or {@code null} if
|
||||||
* mappings were not modified.
|
* mappings were not modified.
|
||||||
*/
|
*/
|
||||||
Mapper parse(ParseContext context) throws IOException;
|
public abstract Mapper parse(ParseContext context) throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,6 @@ public abstract class MappedFieldType extends FieldType {
|
||||||
|
|
||||||
public static class Names {
|
public static class Names {
|
||||||
|
|
||||||
private final String shortName;
|
|
||||||
|
|
||||||
private final String indexName;
|
private final String indexName;
|
||||||
|
|
||||||
private final String originalIndexName;
|
private final String originalIndexName;
|
||||||
|
@ -63,23 +61,15 @@ public abstract class MappedFieldType extends FieldType {
|
||||||
private final String fullName;
|
private final String fullName;
|
||||||
|
|
||||||
public Names(String name) {
|
public Names(String name) {
|
||||||
this(name, name, name, name);
|
this(name, name, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Names(String shortName, String indexName, String originalIndexName, String fullName) {
|
public Names(String indexName, String originalIndexName, String fullName) {
|
||||||
this.shortName = shortName;
|
|
||||||
this.indexName = indexName;
|
this.indexName = indexName;
|
||||||
this.originalIndexName = originalIndexName;
|
this.originalIndexName = originalIndexName;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The logical name of the field.
|
|
||||||
*/
|
|
||||||
public String shortName() {
|
|
||||||
return shortName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The indexed name of the field. This is the name under which we will
|
* The indexed name of the field. This is the name under which we will
|
||||||
* store it in the index.
|
* store it in the index.
|
||||||
|
@ -111,15 +101,13 @@ public abstract class MappedFieldType extends FieldType {
|
||||||
if (!fullName.equals(names.fullName)) return false;
|
if (!fullName.equals(names.fullName)) return false;
|
||||||
if (!indexName.equals(names.indexName)) return false;
|
if (!indexName.equals(names.indexName)) return false;
|
||||||
if (!originalIndexName.equals(names.originalIndexName)) return false;
|
if (!originalIndexName.equals(names.originalIndexName)) return false;
|
||||||
if (!shortName.equals(names.shortName)) return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = shortName.hashCode();
|
int result = indexName.hashCode();
|
||||||
result = 31 * result + indexName.hashCode();
|
|
||||||
result = 31 * result + originalIndexName.hashCode();
|
result = 31 * result + originalIndexName.hashCode();
|
||||||
result = 31 * result + fullName.hashCode();
|
result = 31 * result + fullName.hashCode();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -30,11 +30,9 @@ import org.elasticsearch.index.similarity.SimilarityLookupService;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface Mapper extends ToXContent, Iterable<Mapper> {
|
public abstract class Mapper implements ToXContent, Iterable<Mapper> {
|
||||||
|
|
||||||
Mapper[] EMPTY_ARRAY = new Mapper[0];
|
public static class BuilderContext {
|
||||||
|
|
||||||
class BuilderContext {
|
|
||||||
private final Settings indexSettings;
|
private final Settings indexSettings;
|
||||||
private final ContentPath contentPath;
|
private final ContentPath contentPath;
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ public interface Mapper extends ToXContent, Iterable<Mapper> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Builder<T extends Builder, Y extends Mapper> {
|
public static abstract class Builder<T extends Builder, Y extends Mapper> {
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
|
@ -78,7 +76,7 @@ public interface Mapper extends ToXContent, Iterable<Mapper> {
|
||||||
public abstract Y build(BuilderContext context);
|
public abstract Y build(BuilderContext context);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TypeParser {
|
public interface TypeParser {
|
||||||
|
|
||||||
class ParserContext {
|
class ParserContext {
|
||||||
|
|
||||||
|
@ -126,7 +124,20 @@ public interface Mapper extends ToXContent, Iterable<Mapper> {
|
||||||
Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException;
|
Mapper.Builder<?,?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name();
|
private final String simpleName;
|
||||||
|
|
||||||
void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException;
|
public Mapper(String simpleName) {
|
||||||
|
this.simpleName = simpleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the simple name, which identifies this mapper against other mappers at the same level in the mappers hierarchy
|
||||||
|
* TODO: make this protected once Mapper, FieldMapper and AbstractFieldMapper are merged together */
|
||||||
|
public final String simpleName() {
|
||||||
|
return simpleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the canonical name which uniquely identifies the mapper against other mappers in a type. */
|
||||||
|
public abstract String name();
|
||||||
|
|
||||||
|
public abstract void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public final class Mapping implements ToXContent {
|
||||||
return (T) rootMappersMap.get(clazz);
|
return (T) rootMappersMap.get(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @see DocumentMapper#merge(Mapping, boolean) */
|
/** @see DocumentMapper#merge(Mapping, boolean, boolean) */
|
||||||
public void merge(Mapping mergeWith, MergeResult mergeResult) {
|
public void merge(Mapping mergeWith, MergeResult mergeResult) {
|
||||||
assert metadataMappers.length == mergeWith.metadataMappers.length;
|
assert metadataMappers.length == mergeWith.metadataMappers.length;
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,8 @@ public abstract class MetadataFieldMapper extends AbstractFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MetadataFieldMapper(MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
protected MetadataFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings, MultiFields.empty(), null);
|
super(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, MultiFields.empty(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,7 +60,7 @@ import java.util.TreeMap;
|
||||||
|
|
||||||
import static org.elasticsearch.index.mapper.core.TypeParsers.DOC_VALUES;
|
import static org.elasticsearch.index.mapper.core.TypeParsers.DOC_VALUES;
|
||||||
|
|
||||||
public abstract class AbstractFieldMapper implements FieldMapper {
|
public abstract class AbstractFieldMapper extends FieldMapper {
|
||||||
|
|
||||||
public static class Defaults {
|
public static class Defaults {
|
||||||
public static final float BOOST = 1.0f;
|
public static final float BOOST = 1.0f;
|
||||||
|
@ -229,7 +229,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MappedFieldType.Names buildNames(BuilderContext context) {
|
protected MappedFieldType.Names buildNames(BuilderContext context) {
|
||||||
return new MappedFieldType.Names(name, buildIndexName(context), buildIndexNameClean(context), buildFullName(context));
|
return new MappedFieldType.Names(buildIndexName(context), buildIndexNameClean(context), buildFullName(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String buildIndexName(BuilderContext context) {
|
protected String buildIndexName(BuilderContext context) {
|
||||||
|
@ -263,11 +263,12 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
protected CopyTo copyTo;
|
protected CopyTo copyTo;
|
||||||
protected final boolean indexCreatedBefore2x;
|
protected final boolean indexCreatedBefore2x;
|
||||||
|
|
||||||
protected AbstractFieldMapper(MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
protected AbstractFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
this(fieldType, docValues, fieldDataSettings, indexSettings, MultiFields.empty(), null);
|
this(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, MultiFields.empty(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractFieldMapper(MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
protected AbstractFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
|
super(simpleName);
|
||||||
assert indexSettings != null;
|
assert indexSettings != null;
|
||||||
this.indexCreatedBefore2x = Version.indexCreated(indexSettings).before(Version.V_2_0_0);
|
this.indexCreatedBefore2x = Version.indexCreated(indexSettings).before(Version.V_2_0_0);
|
||||||
this.customFieldDataSettings = fieldDataSettings;
|
this.customFieldDataSettings = fieldDataSettings;
|
||||||
|
@ -315,8 +316,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
// TODO: cleanup names so Mapper knows about paths, so that it is always clear whether we are using short or full name
|
return fieldType().names().fullName();
|
||||||
return fieldType().names().shortName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract MappedFieldType defaultFieldType();
|
public abstract MappedFieldType defaultFieldType();
|
||||||
|
@ -424,7 +424,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject(fieldType().names().shortName());
|
builder.startObject(simpleName());
|
||||||
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
||||||
doXContentBody(builder, includeDefaults, params);
|
doXContentBody(builder, includeDefaults, params);
|
||||||
return builder.endObject();
|
return builder.endObject();
|
||||||
|
@ -433,7 +433,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
|
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
|
||||||
|
|
||||||
builder.field("type", contentType());
|
builder.field("type", contentType());
|
||||||
if (indexCreatedBefore2x && (includeDefaults || !fieldType().names().shortName().equals(fieldType().names().originalIndexName()))) {
|
if (indexCreatedBefore2x && (includeDefaults || !simpleName().equals(fieldType().names().originalIndexName()))) {
|
||||||
builder.field("index_name", fieldType().names().originalIndexName());
|
builder.field("index_name", fieldType().names().originalIndexName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
ContentPath.Type origPathType = context.path().pathType();
|
ContentPath.Type origPathType = context.path().pathType();
|
||||||
context.path().pathType(pathType);
|
context.path().pathType(pathType);
|
||||||
|
|
||||||
context.path().add(mainField.fieldType().names().shortName());
|
context.path().add(mainField.simpleName());
|
||||||
for (ObjectCursor<FieldMapper> cursor : mappers.values()) {
|
for (ObjectCursor<FieldMapper> cursor : mappers.values()) {
|
||||||
cursor.value.parse(context);
|
cursor.value.parse(context);
|
||||||
}
|
}
|
||||||
|
@ -654,7 +654,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
|
|
||||||
for (ObjectCursor<FieldMapper> cursor : mergeWithMultiField.multiFields.mappers.values()) {
|
for (ObjectCursor<FieldMapper> cursor : mergeWithMultiField.multiFields.mappers.values()) {
|
||||||
FieldMapper mergeWithMapper = cursor.value;
|
FieldMapper mergeWithMapper = cursor.value;
|
||||||
Mapper mergeIntoMapper = mappers.get(mergeWithMapper.fieldType().names().shortName());
|
Mapper mergeIntoMapper = mappers.get(mergeWithMapper.simpleName());
|
||||||
if (mergeIntoMapper == null) {
|
if (mergeIntoMapper == null) {
|
||||||
// no mapping, simply add it if not simulating
|
// no mapping, simply add it if not simulating
|
||||||
if (!mergeResult.simulate()) {
|
if (!mergeResult.simulate()) {
|
||||||
|
@ -665,7 +665,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
||||||
if (newMappersBuilder == null) {
|
if (newMappersBuilder == null) {
|
||||||
newMappersBuilder = ImmutableOpenMap.builder(mappers);
|
newMappersBuilder = ImmutableOpenMap.builder(mappers);
|
||||||
}
|
}
|
||||||
newMappersBuilder.put(mergeWithMapper.fieldType().names().shortName(), mergeWithMapper);
|
newMappersBuilder.put(mergeWithMapper.simpleName(), mergeWithMapper);
|
||||||
if (mergeWithMapper instanceof AbstractFieldMapper) {
|
if (mergeWithMapper instanceof AbstractFieldMapper) {
|
||||||
if (newFieldMappers == null) {
|
if (newFieldMappers == null) {
|
||||||
newFieldMappers = new ArrayList<>(2);
|
newFieldMappers = new ArrayList<>(2);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class BinaryFieldMapper extends AbstractFieldMapper {
|
||||||
public BinaryFieldMapper build(BuilderContext context) {
|
public BinaryFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
((BinaryFieldType)fieldType).setTryUncompressing(context.indexCreatedVersion().before(Version.V_2_0_0));
|
((BinaryFieldType)fieldType).setTryUncompressing(context.indexCreatedVersion().before(Version.V_2_0_0));
|
||||||
return new BinaryFieldMapper(fieldType, docValues,
|
return new BinaryFieldMapper(name, fieldType, docValues,
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,9 @@ public class BinaryFieldMapper extends AbstractFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BinaryFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected BinaryFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class BooleanFieldMapper extends AbstractFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public BooleanFieldMapper build(BuilderContext context) {
|
public BooleanFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
return new BooleanFieldMapper(fieldType, docValues,
|
return new BooleanFieldMapper(name, fieldType, docValues,
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,9 +194,9 @@ public class BooleanFieldMapper extends AbstractFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BooleanFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected BooleanFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class ByteFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public ByteFieldMapper build(BuilderContext context) {
|
public ByteFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
ByteFieldMapper fieldMapper = new ByteFieldMapper(fieldType, docValues, ignoreMalformed(context),
|
ByteFieldMapper fieldMapper = new ByteFieldMapper(name, fieldType, docValues, ignoreMalformed(context),
|
||||||
coerce(context), fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
coerce(context), fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
|
@ -193,10 +193,10 @@ public class ByteFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ByteFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected ByteFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
||||||
CompletionFieldType completionFieldType = (CompletionFieldType)fieldType;
|
CompletionFieldType completionFieldType = (CompletionFieldType)fieldType;
|
||||||
completionFieldType.setProvider(new AnalyzingCompletionLookupProvider(preserveSeparators, false, preservePositionIncrements, payloads));
|
completionFieldType.setProvider(new AnalyzingCompletionLookupProvider(preserveSeparators, false, preservePositionIncrements, payloads));
|
||||||
completionFieldType.setContextMapping(contextMapping);
|
completionFieldType.setContextMapping(contextMapping);
|
||||||
return new CompletionFieldMapper(fieldType, maxInputLength, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
return new CompletionFieldMapper(name, fieldType, maxInputLength, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -311,8 +311,8 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
||||||
|
|
||||||
private int maxInputLength;
|
private int maxInputLength;
|
||||||
|
|
||||||
public CompletionFieldMapper(MappedFieldType fieldType, int maxInputLength, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
public CompletionFieldMapper(String simpleName, MappedFieldType fieldType, int maxInputLength, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, false, null, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, false, null, indexSettings, multiFields, copyTo);
|
||||||
this.maxInputLength = maxInputLength;
|
this.maxInputLength = maxInputLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject(fieldType().names().shortName())
|
builder.startObject(simpleName())
|
||||||
.field(Fields.TYPE, CONTENT_TYPE);
|
.field(Fields.TYPE, CONTENT_TYPE);
|
||||||
|
|
||||||
builder.field(Fields.ANALYZER, fieldType().indexAnalyzer().name());
|
builder.field(Fields.ANALYZER, fieldType().indexAnalyzer().name());
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class DateFieldMapper extends NumberFieldMapper {
|
||||||
public DateFieldMapper build(BuilderContext context) {
|
public DateFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
fieldType.setNullValue(nullValue);
|
fieldType.setNullValue(nullValue);
|
||||||
DateFieldMapper fieldMapper = new DateFieldMapper(fieldType,
|
DateFieldMapper fieldMapper = new DateFieldMapper(name, fieldType,
|
||||||
docValues, ignoreMalformed(context), coerce(context),
|
docValues, ignoreMalformed(context), coerce(context),
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
|
@ -414,9 +414,9 @@ public class DateFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DateFieldMapper(MappedFieldType fieldType, Boolean docValues, Explicit<Boolean> ignoreMalformed,Explicit<Boolean> coerce,
|
protected DateFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, Explicit<Boolean> ignoreMalformed,Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class DoubleFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public DoubleFieldMapper build(BuilderContext context) {
|
public DoubleFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
DoubleFieldMapper fieldMapper = new DoubleFieldMapper(fieldType, docValues, ignoreMalformed(context), coerce(context),
|
DoubleFieldMapper fieldMapper = new DoubleFieldMapper(name, fieldType, docValues, ignoreMalformed(context), coerce(context),
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
|
@ -201,9 +201,9 @@ public class DoubleFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DoubleFieldMapper(MappedFieldType fieldType, Boolean docValues, Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
protected DoubleFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class FloatFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public FloatFieldMapper build(BuilderContext context) {
|
public FloatFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
FloatFieldMapper fieldMapper = new FloatFieldMapper(fieldType, docValues, ignoreMalformed(context), coerce(context),
|
FloatFieldMapper fieldMapper = new FloatFieldMapper(name, fieldType, docValues, ignoreMalformed(context), coerce(context),
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
|
@ -202,10 +202,10 @@ public class FloatFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FloatFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected FloatFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class IntegerFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public IntegerFieldMapper build(BuilderContext context) {
|
public IntegerFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
IntegerFieldMapper fieldMapper = new IntegerFieldMapper(fieldType, docValues,
|
IntegerFieldMapper fieldMapper = new IntegerFieldMapper(name, fieldType, docValues,
|
||||||
ignoreMalformed(context), coerce(context), fieldDataSettings,
|
ignoreMalformed(context), coerce(context), fieldDataSettings,
|
||||||
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
|
@ -202,11 +202,11 @@ public class IntegerFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IntegerFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected IntegerFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings,
|
@Nullable Settings fieldDataSettings,
|
||||||
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class LongFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public LongFieldMapper build(BuilderContext context) {
|
public LongFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
LongFieldMapper fieldMapper = new LongFieldMapper(fieldType, docValues,
|
LongFieldMapper fieldMapper = new LongFieldMapper(name, fieldType, docValues,
|
||||||
ignoreMalformed(context), coerce(context), fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
ignoreMalformed(context), coerce(context), fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
|
@ -201,11 +201,11 @@ public class LongFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LongFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected LongFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings,
|
@Nullable Settings fieldDataSettings,
|
||||||
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class Murmur3FieldMapper extends LongFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public Murmur3FieldMapper build(BuilderContext context) {
|
public Murmur3FieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
Murmur3FieldMapper fieldMapper = new Murmur3FieldMapper(fieldType, docValues,
|
Murmur3FieldMapper fieldMapper = new Murmur3FieldMapper(name, fieldType, docValues,
|
||||||
ignoreMalformed(context), coerce(context),
|
ignoreMalformed(context), coerce(context),
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
|
@ -119,11 +119,11 @@ public class Murmur3FieldMapper extends LongFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Murmur3FieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected Murmur3FieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings,
|
@Nullable Settings fieldDataSettings,
|
||||||
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce,
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce,
|
||||||
fieldDataSettings, indexSettings, multiFields, copyTo);
|
fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,11 +185,11 @@ public abstract class NumberFieldMapper extends AbstractFieldMapper implements A
|
||||||
*/
|
*/
|
||||||
protected final boolean useSortedNumericDocValues;
|
protected final boolean useSortedNumericDocValues;
|
||||||
|
|
||||||
protected NumberFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected NumberFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce, @Nullable Settings fieldDataSettings, Settings indexSettings,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce, @Nullable Settings fieldDataSettings, Settings indexSettings,
|
||||||
MultiFields multiFields, CopyTo copyTo) {
|
MultiFields multiFields, CopyTo copyTo) {
|
||||||
// LUCENE 4 UPGRADE: Since we can't do anything before the super call, we have to push the boost check down to subclasses
|
// LUCENE 4 UPGRADE: Since we can't do anything before the super call, we have to push the boost check down to subclasses
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
this.ignoreMalformed = ignoreMalformed;
|
this.ignoreMalformed = ignoreMalformed;
|
||||||
this.coerce = coerce;
|
this.coerce = coerce;
|
||||||
this.useSortedNumericDocValues = Version.indexCreated(indexSettings).onOrAfter(Version.V_1_4_0_Beta1);
|
this.useSortedNumericDocValues = Version.indexCreated(indexSettings).onOrAfter(Version.V_1_4_0_Beta1);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class ShortFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public ShortFieldMapper build(BuilderContext context) {
|
public ShortFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
ShortFieldMapper fieldMapper = new ShortFieldMapper(fieldType, docValues,
|
ShortFieldMapper fieldMapper = new ShortFieldMapper(name, fieldType, docValues,
|
||||||
ignoreMalformed(context), coerce(context), fieldDataSettings,
|
ignoreMalformed(context), coerce(context), fieldDataSettings,
|
||||||
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
|
@ -199,11 +199,11 @@ public class ShortFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ShortFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected ShortFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings,
|
@Nullable Settings fieldDataSettings,
|
||||||
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce,
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce,
|
||||||
fieldDataSettings, indexSettings, multiFields, copyTo);
|
fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class StringFieldMapper extends AbstractFieldMapper implements AllFieldMa
|
||||||
defaultFieldType.freeze();
|
defaultFieldType.freeze();
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
StringFieldMapper fieldMapper = new StringFieldMapper(
|
StringFieldMapper fieldMapper = new StringFieldMapper(
|
||||||
fieldType, defaultFieldType, docValues, positionOffsetGap, ignoreAbove,
|
name, fieldType, defaultFieldType, docValues, positionOffsetGap, ignoreAbove,
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
|
@ -223,10 +223,10 @@ public class StringFieldMapper extends AbstractFieldMapper implements AllFieldMa
|
||||||
private int ignoreAbove;
|
private int ignoreAbove;
|
||||||
private final MappedFieldType defaultFieldType;
|
private final MappedFieldType defaultFieldType;
|
||||||
|
|
||||||
protected StringFieldMapper(MappedFieldType fieldType, MappedFieldType defaultFieldType, Boolean docValues,
|
protected StringFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Boolean docValues,
|
||||||
int positionOffsetGap, int ignoreAbove, @Nullable Settings fieldDataSettings,
|
int positionOffsetGap, int ignoreAbove, @Nullable Settings fieldDataSettings,
|
||||||
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
if (fieldType.tokenized() && fieldType.indexOptions() != NONE && fieldType().hasDocValues()) {
|
if (fieldType.tokenized() && fieldType.indexOptions() != NONE && fieldType().hasDocValues()) {
|
||||||
throw new MapperParsingException("Field [" + fieldType.names().fullName() + "] cannot be analyzed and have doc values");
|
throw new MapperParsingException("Field [" + fieldType.names().fullName() + "] cannot be analyzed and have doc values");
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TokenCountFieldMapper extends IntegerFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public TokenCountFieldMapper build(BuilderContext context) {
|
public TokenCountFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
TokenCountFieldMapper fieldMapper = new TokenCountFieldMapper(fieldType, docValues,
|
TokenCountFieldMapper fieldMapper = new TokenCountFieldMapper(name, fieldType, docValues,
|
||||||
ignoreMalformed(context), coerce(context), fieldDataSettings, context.indexSettings(),
|
ignoreMalformed(context), coerce(context), fieldDataSettings, context.indexSettings(),
|
||||||
analyzer, multiFieldsBuilder.build(this, context), copyTo);
|
analyzer, multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
|
@ -127,10 +127,10 @@ public class TokenCountFieldMapper extends IntegerFieldMapper {
|
||||||
|
|
||||||
private NamedAnalyzer analyzer;
|
private NamedAnalyzer analyzer;
|
||||||
|
|
||||||
protected TokenCountFieldMapper(MappedFieldType fieldType, Boolean docValues, Explicit<Boolean> ignoreMalformed,
|
protected TokenCountFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, Explicit<Boolean> ignoreMalformed,
|
||||||
Explicit<Boolean> coerce, Settings fieldDataSettings, Settings indexSettings,
|
Explicit<Boolean> coerce, Settings fieldDataSettings, Settings indexSettings,
|
||||||
NamedAnalyzer analyzer, MultiFields multiFields, CopyTo copyTo) {
|
NamedAnalyzer analyzer, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce, fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
this.analyzer = analyzer;
|
this.analyzer = analyzer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public class TokenCountFieldMapper extends IntegerFieldMapper {
|
||||||
if (valueAndBoost.value() == null) {
|
if (valueAndBoost.value() == null) {
|
||||||
count = fieldType().nullValue();
|
count = fieldType().nullValue();
|
||||||
} else {
|
} else {
|
||||||
count = countPositions(analyzer.analyzer().tokenStream(fieldType().names().shortName(), valueAndBoost.value()));
|
count = countPositions(analyzer.analyzer().tokenStream(simpleName(), valueAndBoost.value()));
|
||||||
}
|
}
|
||||||
addIntegerFields(context, fields, count, valueAndBoost.boost());
|
addIntegerFields(context, fields, count, valueAndBoost.boost());
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeFl
|
||||||
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeIntegerValue;
|
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeIntegerValue;
|
||||||
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeMapValue;
|
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeMapValue;
|
||||||
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeStringValue;
|
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeStringValue;
|
||||||
import static org.elasticsearch.index.mapper.FieldMapper.DOC_VALUES_FORMAT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -273,7 +272,7 @@ public class TypeParsers {
|
||||||
} else if (propName.equals("postings_format") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
|
} else if (propName.equals("postings_format") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
|
||||||
// ignore for old indexes
|
// ignore for old indexes
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
} else if (propName.equals(DOC_VALUES_FORMAT) && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
|
} else if (propName.equals("doc_values_format") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
|
||||||
// ignore for old indexes
|
// ignore for old indexes
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
} else if (propName.equals("similarity")) {
|
} else if (propName.equals("similarity")) {
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
||||||
fieldType.setHasDocValues(false);
|
fieldType.setHasDocValues(false);
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
|
|
||||||
return new GeoPointFieldMapper(fieldType, docValues, fieldDataSettings, context.indexSettings(), origPathType,
|
return new GeoPointFieldMapper(name, fieldType, docValues, fieldDataSettings, context.indexSettings(), origPathType,
|
||||||
latMapper, lonMapper, geohashMapper, multiFieldsBuilder.build(this, context));
|
latMapper, lonMapper, geohashMapper, multiFieldsBuilder.build(this, context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -586,9 +586,9 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
||||||
|
|
||||||
private final StringFieldMapper geohashMapper;
|
private final StringFieldMapper geohashMapper;
|
||||||
|
|
||||||
public GeoPointFieldMapper(MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings,
|
public GeoPointFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings,
|
||||||
ContentPath.Type pathType, DoubleFieldMapper latMapper, DoubleFieldMapper lonMapper, StringFieldMapper geohashMapper,MultiFields multiFields) {
|
ContentPath.Type pathType, DoubleFieldMapper latMapper, DoubleFieldMapper lonMapper, StringFieldMapper geohashMapper,MultiFields multiFields) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings, multiFields, null);
|
super(simpleName, fieldType, docValues, fieldDataSettings, indexSettings, multiFields, null);
|
||||||
this.pathType = pathType;
|
this.pathType = pathType;
|
||||||
this.latMapper = latMapper;
|
this.latMapper = latMapper;
|
||||||
this.lonMapper = lonMapper;
|
this.lonMapper = lonMapper;
|
||||||
|
@ -629,7 +629,7 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
||||||
public Mapper parse(ParseContext context) throws IOException {
|
public Mapper parse(ParseContext context) throws IOException {
|
||||||
ContentPath.Type origPathType = context.path().pathType();
|
ContentPath.Type origPathType = context.path().pathType();
|
||||||
context.path().pathType(pathType);
|
context.path().pathType(pathType);
|
||||||
context.path().add(fieldType().names().shortName());
|
context.path().add(simpleName());
|
||||||
|
|
||||||
GeoPoint sparse = context.parseExternalValue(GeoPoint.class);
|
GeoPoint sparse = context.parseExternalValue(GeoPoint.class);
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
||||||
}
|
}
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
|
|
||||||
return new GeoShapeFieldMapper(fieldType, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
return new GeoShapeFieldMapper(name, fieldType, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,8 +358,8 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoShapeFieldMapper(MappedFieldType fieldType, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
public GeoShapeFieldMapper(String simpleName, MappedFieldType fieldType, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, false, null, indexSettings, multiFields, copyTo);
|
super(simpleName, fieldType, false, null, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -59,7 +59,7 @@ import static org.elasticsearch.index.mapper.core.TypeParsers.parseField;
|
||||||
*/
|
*/
|
||||||
public class AllFieldMapper extends MetadataFieldMapper {
|
public class AllFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
public interface IncludeInAll extends Mapper {
|
public interface IncludeInAll {
|
||||||
|
|
||||||
void includeInAll(Boolean includeInAll);
|
void includeInAll(Boolean includeInAll);
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ public class AllFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
protected AllFieldMapper(MappedFieldType fieldType, EnabledAttributeMapper enabled,
|
protected AllFieldMapper(MappedFieldType fieldType, EnabledAttributeMapper enabled,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, false, fieldDataSettings, indexSettings);
|
super(NAME, fieldType, false, fieldDataSettings, indexSettings);
|
||||||
this.enabledState = enabled;
|
this.enabledState = enabled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class FieldNamesFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FieldNamesFieldMapper(MappedFieldType fieldType, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
public FieldNamesFieldMapper(MappedFieldType fieldType, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, false, fieldDataSettings, indexSettings);
|
super(NAME, fieldType, false, fieldDataSettings, indexSettings);
|
||||||
this.defaultFieldType = Defaults.FIELD_TYPE;
|
this.defaultFieldType = Defaults.FIELD_TYPE;
|
||||||
this.pre13Index = Version.indexCreated(indexSettings).before(Version.V_1_3_0);
|
this.pre13Index = Version.indexCreated(indexSettings).before(Version.V_1_3_0);
|
||||||
if (this.pre13Index) {
|
if (this.pre13Index) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IdFieldMapper build(BuilderContext context) {
|
public IdFieldMapper build(BuilderContext context) {
|
||||||
fieldType.setNames(new MappedFieldType.Names(name, indexName, indexName, name));
|
fieldType.setNames(new MappedFieldType.Names(indexName, indexName, name));
|
||||||
return new IdFieldMapper(fieldType, docValues, path, fieldDataSettings, context.indexSettings());
|
return new IdFieldMapper(fieldType, docValues, path, fieldDataSettings, context.indexSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ public class IdFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
protected IdFieldMapper(MappedFieldType fieldType, Boolean docValues, String path,
|
protected IdFieldMapper(MappedFieldType fieldType, Boolean docValues, String path,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings);
|
super(NAME, fieldType, docValues, fieldDataSettings, indexSettings);
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexFieldMapper build(BuilderContext context) {
|
public IndexFieldMapper build(BuilderContext context) {
|
||||||
fieldType.setNames(new MappedFieldType.Names(name, indexName, indexName, name));
|
fieldType.setNames(new MappedFieldType.Names(indexName, indexName, name));
|
||||||
return new IndexFieldMapper(fieldType, enabledState, fieldDataSettings, context.indexSettings());
|
return new IndexFieldMapper(fieldType, enabledState, fieldDataSettings, context.indexSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ public class IndexFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
public IndexFieldMapper(MappedFieldType fieldType, EnabledAttributeMapper enabledState,
|
public IndexFieldMapper(MappedFieldType fieldType, EnabledAttributeMapper enabledState,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, false, fieldDataSettings, indexSettings);
|
super(NAME, fieldType, false, fieldDataSettings, indexSettings);
|
||||||
this.enabledState = enabledState;
|
this.enabledState = enabledState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ public class ParentFieldMapper extends MetadataFieldMapper {
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
protected ParentFieldMapper(MappedFieldType fieldType, String type, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
protected ParentFieldMapper(MappedFieldType fieldType, String type, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, Version.indexCreated(indexSettings).onOrAfter(Version.V_2_0_0), fieldDataSettings, indexSettings);
|
super(NAME, fieldType, Version.indexCreated(indexSettings).onOrAfter(Version.V_2_0_0), fieldDataSettings, indexSettings);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class RoutingFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RoutingFieldMapper(MappedFieldType fieldType, boolean required, String path, Settings indexSettings) {
|
protected RoutingFieldMapper(MappedFieldType fieldType, boolean required, String path, Settings indexSettings) {
|
||||||
super(fieldType, false, null, indexSettings);
|
super(NAME, fieldType, false, null, indexSettings);
|
||||||
this.required = required;
|
this.required = required;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ public class SizeFieldMapper extends MetadataFieldMapper {
|
||||||
public static final String CONTENT_TYPE = "_size";
|
public static final String CONTENT_TYPE = "_size";
|
||||||
|
|
||||||
public static class Defaults extends IntegerFieldMapper.Defaults {
|
public static class Defaults extends IntegerFieldMapper.Defaults {
|
||||||
public static final String NAME = CONTENT_TYPE;
|
|
||||||
public static final EnabledAttributeMapper ENABLED_STATE = EnabledAttributeMapper.UNSET_DISABLED;
|
public static final EnabledAttributeMapper ENABLED_STATE = EnabledAttributeMapper.UNSET_DISABLED;
|
||||||
|
|
||||||
public static final MappedFieldType SIZE_FIELD_TYPE = IntegerFieldMapper.Defaults.FIELD_TYPE.clone();
|
public static final MappedFieldType SIZE_FIELD_TYPE = IntegerFieldMapper.Defaults.FIELD_TYPE.clone();
|
||||||
|
@ -72,7 +71,7 @@ public class SizeFieldMapper extends MetadataFieldMapper {
|
||||||
protected EnabledAttributeMapper enabledState = EnabledAttributeMapper.UNSET_DISABLED;
|
protected EnabledAttributeMapper enabledState = EnabledAttributeMapper.UNSET_DISABLED;
|
||||||
|
|
||||||
public Builder(MappedFieldType existing) {
|
public Builder(MappedFieldType existing) {
|
||||||
super(Defaults.NAME, existing == null ? Defaults.SIZE_FIELD_TYPE : existing);
|
super(NAME, existing == null ? Defaults.SIZE_FIELD_TYPE : existing);
|
||||||
builder = this;
|
builder = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,14 +114,14 @@ public class SizeFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SizeFieldMapper(EnabledAttributeMapper enabled, MappedFieldType fieldType, Settings indexSettings) {
|
public SizeFieldMapper(EnabledAttributeMapper enabled, MappedFieldType fieldType, Settings indexSettings) {
|
||||||
super(fieldType, false, null, indexSettings);
|
super(NAME, fieldType, false, null, indexSettings);
|
||||||
this.enabledState = enabled;
|
this.enabledState = enabled;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String contentType() {
|
protected String contentType() {
|
||||||
return Defaults.NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enabled() {
|
public boolean enabled() {
|
||||||
|
|
|
@ -256,7 +256,7 @@ public class SourceFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
protected SourceFieldMapper(boolean enabled, String format, Boolean compress, long compressThreshold,
|
protected SourceFieldMapper(boolean enabled, String format, Boolean compress, long compressThreshold,
|
||||||
String[] includes, String[] excludes, Settings indexSettings) {
|
String[] includes, String[] excludes, Settings indexSettings) {
|
||||||
super(Defaults.FIELD_TYPE.clone(), false, null, indexSettings); // Only stored.
|
super(NAME, Defaults.FIELD_TYPE.clone(), false, null, indexSettings); // Only stored.
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.compress = compress;
|
this.compress = compress;
|
||||||
this.compressThreshold = compressThreshold;
|
this.compressThreshold = compressThreshold;
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class TTLFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
protected TTLFieldMapper(MappedFieldType fieldType, EnabledAttributeMapper enabled, long defaultTTL,
|
protected TTLFieldMapper(MappedFieldType fieldType, EnabledAttributeMapper enabled, long defaultTTL,
|
||||||
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
@Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, false, fieldDataSettings, indexSettings);
|
super(NAME, fieldType, false, fieldDataSettings, indexSettings);
|
||||||
this.enabledState = enabled;
|
this.enabledState = enabled;
|
||||||
this.defaultTTL = defaultTTL;
|
this.defaultTTL = defaultTTL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class TimestampFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
protected TimestampFieldMapper(MappedFieldType fieldType, Boolean docValues, EnabledAttributeMapper enabledState, String path,
|
protected TimestampFieldMapper(MappedFieldType fieldType, Boolean docValues, EnabledAttributeMapper enabledState, String path,
|
||||||
String defaultTimestamp, Boolean ignoreMissing, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
String defaultTimestamp, Boolean ignoreMissing, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, docValues, fieldDataSettings, indexSettings);
|
super(NAME, fieldType, docValues, fieldDataSettings, indexSettings);
|
||||||
this.enabledState = enabledState;
|
this.enabledState = enabledState;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.defaultTimestamp = defaultTimestamp;
|
this.defaultTimestamp = defaultTimestamp;
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class TypeFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypeFieldMapper build(BuilderContext context) {
|
public TypeFieldMapper build(BuilderContext context) {
|
||||||
fieldType.setNames(new MappedFieldType.Names(name, indexName, indexName, name));
|
fieldType.setNames(new MappedFieldType.Names(indexName, indexName, name));
|
||||||
return new TypeFieldMapper(fieldType, context.indexSettings());
|
return new TypeFieldMapper(fieldType, context.indexSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public class TypeFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeFieldMapper(MappedFieldType fieldType, Settings indexSettings) {
|
public TypeFieldMapper(MappedFieldType fieldType, Settings indexSettings) {
|
||||||
super(fieldType, false, null, indexSettings);
|
super(NAME, fieldType, false, null, indexSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class UidFieldMapper extends MetadataFieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UidFieldMapper build(BuilderContext context) {
|
public UidFieldMapper build(BuilderContext context) {
|
||||||
fieldType.setNames(new MappedFieldType.Names(name, indexName, indexName, name));
|
fieldType.setNames(new MappedFieldType.Names(indexName, indexName, name));
|
||||||
return new UidFieldMapper(fieldType, docValues, fieldDataSettings, context.indexSettings());
|
return new UidFieldMapper(fieldType, docValues, fieldDataSettings, context.indexSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class UidFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UidFieldMapper(MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
protected UidFieldMapper(MappedFieldType fieldType, Boolean docValues, @Nullable Settings fieldDataSettings, Settings indexSettings) {
|
||||||
super(fieldType, docValuesEnabled(docValues, indexSettings), fieldDataSettings, indexSettings);
|
super(NAME, fieldType, docValuesEnabled(docValues, indexSettings), fieldDataSettings, indexSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Boolean docValuesEnabled(Boolean docValues, Settings indexSettings) {
|
static Boolean docValuesEnabled(Boolean docValues, Settings indexSettings) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class VersionFieldMapper extends MetadataFieldMapper {
|
||||||
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
|
||||||
Map.Entry<String, Object> entry = iterator.next();
|
Map.Entry<String, Object> entry = iterator.next();
|
||||||
String fieldName = Strings.toUnderscoreCase(entry.getKey());
|
String fieldName = Strings.toUnderscoreCase(entry.getKey());
|
||||||
if (fieldName.equals(DOC_VALUES_FORMAT) && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
|
if (fieldName.equals("doc_values_format") && parserContext.indexVersionCreated().before(Version.V_2_0_0)) {
|
||||||
// ignore in 1.x, reject in 2.x
|
// ignore in 1.x, reject in 2.x
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class VersionFieldMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public VersionFieldMapper(Settings indexSettings) {
|
public VersionFieldMapper(Settings indexSettings) {
|
||||||
super(Defaults.FIELD_TYPE, true, null, indexSettings);
|
super(NAME, Defaults.FIELD_TYPE, true, null, indexSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class IpFieldMapper extends NumberFieldMapper {
|
||||||
@Override
|
@Override
|
||||||
public IpFieldMapper build(BuilderContext context) {
|
public IpFieldMapper build(BuilderContext context) {
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
IpFieldMapper fieldMapper = new IpFieldMapper(fieldType, docValues, ignoreMalformed(context), coerce(context),
|
IpFieldMapper fieldMapper = new IpFieldMapper(name, fieldType, docValues, ignoreMalformed(context), coerce(context),
|
||||||
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
fieldDataSettings, context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
|
@ -235,11 +235,11 @@ public class IpFieldMapper extends NumberFieldMapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IpFieldMapper(MappedFieldType fieldType, Boolean docValues,
|
protected IpFieldMapper(String simpleName, MappedFieldType fieldType, Boolean docValues,
|
||||||
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
|
||||||
@Nullable Settings fieldDataSettings,
|
@Nullable Settings fieldDataSettings,
|
||||||
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, docValues, ignoreMalformed, coerce,
|
super(simpleName, fieldType, docValues, ignoreMalformed, coerce,
|
||||||
fieldDataSettings, indexSettings, multiFields, copyTo);
|
fieldDataSettings, indexSettings, multiFields, copyTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ import static org.elasticsearch.index.mapper.core.TypeParsers.parsePathType;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Cloneable {
|
public class ObjectMapper extends Mapper implements AllFieldMapper.IncludeInAll, Cloneable {
|
||||||
|
|
||||||
public static final String CONTENT_TYPE = "object";
|
public static final String CONTENT_TYPE = "object";
|
||||||
public static final String NESTED_CONTENT_TYPE = "nested";
|
public static final String NESTED_CONTENT_TYPE = "nested";
|
||||||
|
@ -175,7 +175,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
Map<String, Mapper> mappers = new HashMap<>();
|
Map<String, Mapper> mappers = new HashMap<>();
|
||||||
for (Mapper.Builder builder : mappersBuilders) {
|
for (Mapper.Builder builder : mappersBuilders) {
|
||||||
Mapper mapper = builder.build(context);
|
Mapper mapper = builder.build(context);
|
||||||
mappers.put(mapper.name(), mapper);
|
mappers.put(mapper.simpleName(), mapper);
|
||||||
}
|
}
|
||||||
context.path().pathType(origPathType);
|
context.path().pathType(origPathType);
|
||||||
context.path().remove();
|
context.path().remove();
|
||||||
|
@ -331,8 +331,6 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
private final String fullPath;
|
private final String fullPath;
|
||||||
|
|
||||||
private final boolean enabled;
|
private final boolean enabled;
|
||||||
|
@ -353,7 +351,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
private volatile CopyOnWriteHashMap<String, Mapper> mappers;
|
private volatile CopyOnWriteHashMap<String, Mapper> mappers;
|
||||||
|
|
||||||
ObjectMapper(String name, String fullPath, boolean enabled, Nested nested, Dynamic dynamic, ContentPath.Type pathType, Map<String, Mapper> mappers) {
|
ObjectMapper(String name, String fullPath, boolean enabled, Nested nested, Dynamic dynamic, ContentPath.Type pathType, Map<String, Mapper> mappers) {
|
||||||
this.name = name;
|
super(name);
|
||||||
this.fullPath = fullPath;
|
this.fullPath = fullPath;
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.nested = nested;
|
this.nested = nested;
|
||||||
|
@ -393,7 +391,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
return this.name;
|
return this.fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
|
@ -463,7 +461,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
if (mapper instanceof AllFieldMapper.IncludeInAll) {
|
if (mapper instanceof AllFieldMapper.IncludeInAll) {
|
||||||
((AllFieldMapper.IncludeInAll) mapper).includeInAllIfNotSet(includeInAll);
|
((AllFieldMapper.IncludeInAll) mapper).includeInAllIfNotSet(includeInAll);
|
||||||
}
|
}
|
||||||
mappers = mappers.copyAndPut(mapper.name(), mapper);
|
mappers = mappers.copyAndPut(mapper.simpleName(), mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -516,7 +514,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
List<FieldMapper> newFieldMappers = new ArrayList<>();
|
List<FieldMapper> newFieldMappers = new ArrayList<>();
|
||||||
for (Mapper mapper : mergeWithObject) {
|
for (Mapper mapper : mergeWithObject) {
|
||||||
Mapper mergeWithMapper = mapper;
|
Mapper mergeWithMapper = mapper;
|
||||||
Mapper mergeIntoMapper = mappers.get(mergeWithMapper.name());
|
Mapper mergeIntoMapper = mappers.get(mergeWithMapper.simpleName());
|
||||||
if (mergeIntoMapper == null) {
|
if (mergeIntoMapper == null) {
|
||||||
// no mapping, simply add it if not simulating
|
// no mapping, simply add it if not simulating
|
||||||
if (!mergeResult.simulate()) {
|
if (!mergeResult.simulate()) {
|
||||||
|
@ -551,7 +549,7 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll, Clonea
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toXContent(XContentBuilder builder, Params params, ToXContent custom) throws IOException {
|
public void toXContent(XContentBuilder builder, Params params, ToXContent custom) throws IOException {
|
||||||
builder.startObject(name);
|
builder.startObject(simpleName());
|
||||||
if (nested.isNested()) {
|
if (nested.isNested()) {
|
||||||
builder.field("type", NESTED_CONTENT_TYPE);
|
builder.field("type", NESTED_CONTENT_TYPE);
|
||||||
if (nested.isIncludeInParent()) {
|
if (nested.isIncludeInParent()) {
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.index.fieldvisitor.AllFieldsVisitor;
|
import org.elasticsearch.index.fieldvisitor.AllFieldsVisitor;
|
||||||
import org.elasticsearch.index.fieldvisitor.CustomFieldsVisitor;
|
import org.elasticsearch.index.fieldvisitor.CustomFieldsVisitor;
|
||||||
import org.elasticsearch.index.fieldvisitor.FieldsVisitor;
|
import org.elasticsearch.index.fieldvisitor.FieldsVisitor;
|
||||||
import org.elasticsearch.index.fieldvisitor.JustUidFieldsVisitor;
|
|
||||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||||
import org.elasticsearch.index.mapper.internal.SourceFieldMapper;
|
import org.elasticsearch.index.mapper.internal.SourceFieldMapper;
|
||||||
|
@ -363,16 +362,12 @@ public class FetchPhase implements SearchPhase {
|
||||||
private InternalSearchHit.InternalNestedIdentity getInternalNestedIdentity(SearchContext context, int nestedSubDocId, LeafReaderContext subReaderContext, DocumentMapper documentMapper, ObjectMapper nestedObjectMapper) throws IOException {
|
private InternalSearchHit.InternalNestedIdentity getInternalNestedIdentity(SearchContext context, int nestedSubDocId, LeafReaderContext subReaderContext, DocumentMapper documentMapper, ObjectMapper nestedObjectMapper) throws IOException {
|
||||||
int currentParent = nestedSubDocId;
|
int currentParent = nestedSubDocId;
|
||||||
ObjectMapper nestedParentObjectMapper;
|
ObjectMapper nestedParentObjectMapper;
|
||||||
StringBuilder field = new StringBuilder();
|
|
||||||
ObjectMapper current = nestedObjectMapper;
|
ObjectMapper current = nestedObjectMapper;
|
||||||
|
String originalName = nestedObjectMapper.name();
|
||||||
InternalSearchHit.InternalNestedIdentity nestedIdentity = null;
|
InternalSearchHit.InternalNestedIdentity nestedIdentity = null;
|
||||||
do {
|
do {
|
||||||
Filter parentFilter;
|
Filter parentFilter;
|
||||||
nestedParentObjectMapper = documentMapper.findParentObjectMapper(current);
|
nestedParentObjectMapper = documentMapper.findParentObjectMapper(current);
|
||||||
if (field.length() != 0) {
|
|
||||||
field.insert(0, '.');
|
|
||||||
}
|
|
||||||
field.insert(0, current.name());
|
|
||||||
if (nestedParentObjectMapper != null) {
|
if (nestedParentObjectMapper != null) {
|
||||||
if (nestedParentObjectMapper.nested().isNested() == false) {
|
if (nestedParentObjectMapper.nested().isNested() == false) {
|
||||||
current = nestedParentObjectMapper;
|
current = nestedParentObjectMapper;
|
||||||
|
@ -410,8 +405,11 @@ public class FetchPhase implements SearchPhase {
|
||||||
}
|
}
|
||||||
currentParent = nextParent;
|
currentParent = nextParent;
|
||||||
current = nestedObjectMapper = nestedParentObjectMapper;
|
current = nestedObjectMapper = nestedParentObjectMapper;
|
||||||
nestedIdentity = new InternalSearchHit.InternalNestedIdentity(field.toString(), offset, nestedIdentity);
|
int currentPrefix = current == null ? 0 : current.name().length() + 1;
|
||||||
field = new StringBuilder();
|
nestedIdentity = new InternalSearchHit.InternalNestedIdentity(originalName.substring(currentPrefix), offset, nestedIdentity);
|
||||||
|
if (current != null) {
|
||||||
|
originalName = current.name();
|
||||||
|
}
|
||||||
} while (current != null);
|
} while (current != null);
|
||||||
return nestedIdentity;
|
return nestedIdentity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,11 +179,11 @@ public class FieldTypeLookupTests extends ElasticsearchTestCase {
|
||||||
static class FakeFieldMapper extends AbstractFieldMapper {
|
static class FakeFieldMapper extends AbstractFieldMapper {
|
||||||
static Settings dummySettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id).build();
|
static Settings dummySettings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id).build();
|
||||||
public FakeFieldMapper(String fullName, String indexName) {
|
public FakeFieldMapper(String fullName, String indexName) {
|
||||||
super(makeFieldType(fullName, indexName), null, null, dummySettings, null, null);
|
super(fullName, makeFieldType(fullName, indexName), null, null, dummySettings, null, null);
|
||||||
}
|
}
|
||||||
static MappedFieldType makeFieldType(String fullName, String indexName) {
|
static MappedFieldType makeFieldType(String fullName, String indexName) {
|
||||||
FakeFieldType fieldType = new FakeFieldType();
|
FakeFieldType fieldType = new FakeFieldType();
|
||||||
fieldType.setNames(new MappedFieldType.Names(fullName, indexName, indexName, fullName));
|
fieldType.setNames(new MappedFieldType.Names(indexName, indexName, fullName));
|
||||||
return fieldType;
|
return fieldType;
|
||||||
}
|
}
|
||||||
static class FakeFieldType extends MappedFieldType {
|
static class FakeFieldType extends MappedFieldType {
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class ExternalMapper extends AbstractFieldMapper {
|
||||||
context.path().pathType(origPathType);
|
context.path().pathType(origPathType);
|
||||||
setupFieldType(context);
|
setupFieldType(context);
|
||||||
|
|
||||||
return new ExternalMapper(fieldType, generatedValue, mapperName, binMapper, boolMapper, pointMapper, shapeMapper, stringMapper,
|
return new ExternalMapper(name, fieldType, generatedValue, mapperName, binMapper, boolMapper, pointMapper, shapeMapper, stringMapper,
|
||||||
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,11 +170,11 @@ public class ExternalMapper extends AbstractFieldMapper {
|
||||||
private final GeoShapeFieldMapper shapeMapper;
|
private final GeoShapeFieldMapper shapeMapper;
|
||||||
private final FieldMapper stringMapper;
|
private final FieldMapper stringMapper;
|
||||||
|
|
||||||
public ExternalMapper(MappedFieldType fieldType,
|
public ExternalMapper(String simpleName, MappedFieldType fieldType,
|
||||||
String generatedValue, String mapperName,
|
String generatedValue, String mapperName,
|
||||||
BinaryFieldMapper binMapper, BooleanFieldMapper boolMapper, GeoPointFieldMapper pointMapper,
|
BinaryFieldMapper binMapper, BooleanFieldMapper boolMapper, GeoPointFieldMapper pointMapper,
|
||||||
GeoShapeFieldMapper shapeMapper, FieldMapper stringMapper, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
GeoShapeFieldMapper shapeMapper, FieldMapper stringMapper, Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
|
||||||
super(fieldType, false, null, indexSettings,
|
super(simpleName, fieldType, false, null, indexSettings,
|
||||||
multiFields, copyTo);
|
multiFields, copyTo);
|
||||||
this.generatedValue = generatedValue;
|
this.generatedValue = generatedValue;
|
||||||
this.mapperName = mapperName;
|
this.mapperName = mapperName;
|
||||||
|
@ -238,7 +238,7 @@ public class ExternalMapper extends AbstractFieldMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject(fieldType().names().shortName());
|
builder.startObject(simpleName());
|
||||||
builder.field("type", mapperName);
|
builder.field("type", mapperName);
|
||||||
multiFields.toXContent(builder, params);
|
multiFields.toXContent(builder, params);
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class ExternalMetadataMapper extends MetadataFieldMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ExternalMetadataMapper(Settings indexSettings) {
|
protected ExternalMetadataMapper(Settings indexSettings) {
|
||||||
super(FIELD_TYPE, true, null, indexSettings);
|
super(FIELD_NAME, FIELD_TYPE, true, null, indexSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class CompletionPostingsFormatTest extends ElasticsearchTestCase {
|
||||||
AnalyzingCompletionLookupProvider currentProvider = new AnalyzingCompletionLookupProvider(preserveSeparators, false, preservePositionIncrements, usePayloads);
|
AnalyzingCompletionLookupProvider currentProvider = new AnalyzingCompletionLookupProvider(preserveSeparators, false, preservePositionIncrements, usePayloads);
|
||||||
CompletionFieldMapper.CompletionFieldType fieldType = FIELD_TYPE.clone();
|
CompletionFieldMapper.CompletionFieldType fieldType = FIELD_TYPE.clone();
|
||||||
fieldType.setProvider(currentProvider);
|
fieldType.setProvider(currentProvider);
|
||||||
final CompletionFieldMapper mapper = new CompletionFieldMapper(fieldType, Integer.MAX_VALUE, indexSettings, AbstractFieldMapper.MultiFields.empty(), null);
|
final CompletionFieldMapper mapper = new CompletionFieldMapper("foo", fieldType, Integer.MAX_VALUE, indexSettings, AbstractFieldMapper.MultiFields.empty(), null);
|
||||||
Lookup buildAnalyzingLookup = buildAnalyzingLookup(mapper, titles, titles, weights);
|
Lookup buildAnalyzingLookup = buildAnalyzingLookup(mapper, titles, titles, weights);
|
||||||
Field field = buildAnalyzingLookup.getClass().getDeclaredField("maxAnalyzedPathsForOneInput");
|
Field field = buildAnalyzingLookup.getClass().getDeclaredField("maxAnalyzedPathsForOneInput");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
|
|
Loading…
Reference in New Issue