use of org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider in project elasticsearch-skywalker by jprante.
the class Skywalker method getFieldInfo.
public Map<String, Object> getFieldInfo(MapperService mapperService, FieldInfo fi) {
Map<String, Object> m = new HashMap();
m.put("name", fi.name);
m.put("number", fi.number);
m.put("isIndexed", fi.isIndexed());
m.put("hasDocValues", fi.hasDocValues());
m.put("hasNorms", fi.hasNorms());
m.put("hasPayloads", fi.hasPayloads());
m.put("hasVectors", fi.hasVectors());
if (fi.getDocValuesType() != null) {
m.put("docValuesType", fi.getDocValuesType().name());
}
if (fi.getNormType() != null) {
m.put("normType", fi.getNormType().name());
}
if (fi.getIndexOptions() != null) {
m.put("options", fi.getIndexOptions().name());
}
m.put("attributes", fi.attributes());
FieldMapper fieldMapper = mapperService.smartNameFieldMapper(fi.name);
if (fieldMapper != null) {
Map<String, Object> mapper = new HashMap();
mapper.put("fullName", fieldMapper.names().fullName());
mapper.put("indexName", fieldMapper.names().indexName());
mapper.put("indexNameClean", fieldMapper.names().indexNameClean());
mapper.put("boost", fieldMapper.boost());
if (fieldMapper.indexAnalyzer() != null) {
mapper.put("indexAnalyzer", fieldMapper.indexAnalyzer().toString());
}
if (fieldMapper.searchAnalyzer() != null) {
mapper.put("searchAnalyzer", fieldMapper.searchAnalyzer().toString());
}
if (fieldMapper.searchQuoteAnalyzer() != null) {
mapper.put("searchQuoteAnalyzer", fieldMapper.searchQuoteAnalyzer().toString());
}
FieldDataType dataType = fieldMapper.fieldDataType();
if (dataType != null) {
mapper.put("fieldDataType", dataType.getType());
}
FieldType type = fieldMapper.fieldType();
if (type != null) {
mapper.put("indexed", type.indexed());
mapper.put("stored", type.stored());
mapper.put("tokenized", type.tokenized());
mapper.put("omitNorms", type.omitNorms());
mapper.put("storeTermVectors", type.storeTermVectors());
mapper.put("storeTermVectorOffsets", type.storeTermVectorOffsets());
mapper.put("storeTermVectorPayloads", type.storeTermVectorPayloads());
mapper.put("storeTermVectorPositions", type.storeTermVectorPositions());
if (type.numericType() != null) {
mapper.put("numericType", type.numericType().name());
mapper.put("numericPrecisionStep", type.numericPrecisionStep());
}
if (type.docValueType() != null) {
mapper.put("docValueType", type.docValueType().name());
}
}
SimilarityProvider similarityProvider = fieldMapper.similarity();
if (similarityProvider != null) {
mapper.put("similarityPovider", similarityProvider.name());
mapper.put("similarity", similarityProvider.get().getClass().getName());
}
PostingsFormatProvider postingsFormatProvider = fieldMapper.postingsFormatProvider();
if (postingsFormatProvider != null) {
mapper.put("postingsFormatProvider", postingsFormatProvider.name());
mapper.put("postingsFormat", postingsFormatProvider.get().getName());
}
m.put("mapper", mapper);
}
return m;
}
Aggregations