List of usage examples for org.springframework.data.elasticsearch.annotations DateFormat custom
DateFormat custom
To view the source code for org.springframework.data.elasticsearch.annotations DateFormat custom.
Click Source Link
From source file:com.github.vanroy.springdata.jest.MappingBuilder.java
/** * Apply mapping for a single @Field annotation * * @throws IOException// w ww .ja v a2 s . c o m */ private static void addSingleFieldMapping(XContentBuilder xContentBuilder, java.lang.reflect.Field field, Field fieldAnnotation, boolean nestedOrObjectField) throws IOException { xContentBuilder.startObject(field.getName()); if (!nestedOrObjectField) { xContentBuilder.field(FIELD_STORE, fieldAnnotation.store()); } if (FieldType.Auto != fieldAnnotation.type()) { xContentBuilder.field(FIELD_TYPE, fieldAnnotation.type().name().toLowerCase()); if (FieldType.Date == fieldAnnotation.type() && DateFormat.none != fieldAnnotation.format()) { xContentBuilder.field(FIELD_FORMAT, DateFormat.custom == fieldAnnotation.format() ? fieldAnnotation.pattern() : fieldAnnotation.format()); } } if (FieldIndex.not_analyzed == fieldAnnotation.index() || FieldIndex.no == fieldAnnotation.index()) { xContentBuilder.field(FIELD_INDEX, fieldAnnotation.index().name().toLowerCase()); } if (isNotBlank(fieldAnnotation.searchAnalyzer())) { xContentBuilder.field(FIELD_SEARCH_ANALYZER, fieldAnnotation.searchAnalyzer()); } if (isNotBlank(fieldAnnotation.analyzer())) { xContentBuilder.field(FIELD_INDEX_ANALYZER, fieldAnnotation.analyzer()); } xContentBuilder.endObject(); }