Example usage for org.springframework.data.elasticsearch.annotations DateFormat none

List of usage examples for org.springframework.data.elasticsearch.annotations DateFormat none

Introduction

In this page you can find the example usage for org.springframework.data.elasticsearch.annotations DateFormat none.

Prototype

DateFormat none

To view the source code for org.springframework.data.elasticsearch.annotations DateFormat none.

Click Source Link

Usage

From source file:com.github.vanroy.springdata.jest.MappingBuilder.java

/**
 * Apply mapping for a single @Field annotation
 *
 * @throws IOException//from w w  w.ja  v  a2  s .  com
 */
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();
}