Java Code Examples for org.elasticsearch.index.mapper.object.RootObjectMapper#Builder

The following examples show how to use org.elasticsearch.index.mapper.object.RootObjectMapper#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseElasticSearchMapping.java    From ElasticUtils with MIT License 6 votes vote down vote up
public XContentBuilder internalGetMapping() throws IOException {

        // Configure the RootObjectMapper:
        RootObjectMapper.Builder rootObjectMapperBuilder = getRootObjectBuilder();

        // Populate the Settings:
        Settings.Builder settingsBuilder = getSettingsBuilder();

        // Build the Mapping:
        Mapping mapping = new Mapping(
                version,
                rootObjectMapperBuilder.build(new Mapper.BuilderContext(settingsBuilder.build(), new ContentPath())),
                getMetaDataFieldMappers(),
                getSourceTransforms(),
                getMetaData());

        // Turn it into JsonXContent:
        return mapping.toXContent(JsonXContent.contentBuilder().startObject(), ToXContent.EMPTY_PARAMS);
    }
 
Example 2
Source File: LocalWeatherDataMapper.java    From ElasticUtils with MIT License 6 votes vote down vote up
@Override
protected void configureRootObjectBuilder(RootObjectMapper.Builder builder) {
    builder
            .add(new DateFieldMapper.Builder("dateTime"))
            .add(new FloatFieldMapper.Builder("temperature"))
            .add(new FloatFieldMapper.Builder("windSpeed"))
            .add(new FloatFieldMapper.Builder("stationPressure"))
            .add(new StringFieldMapper.Builder("skyCondition"))
            .add(new ObjectMapper.Builder("station")
                    .add(new StringFieldMapper.Builder("wban"))
                    .add(new StringFieldMapper.Builder("name"))
                    .add(new StringFieldMapper.Builder("state"))
                    .add(new StringFieldMapper.Builder("location"))
                    .add(new GeoPointFieldMapper.Builder("coordinates")
                            .enableLatLon(true)
                            .enableGeoHash(false))
                    .nested(ObjectMapper.Nested.newNested(true, false)));
}
 
Example 3
Source File: LocalWeatherDataMapper.java    From JavaElasticSearchExperiment with MIT License 6 votes vote down vote up
@Override
protected void configure(RootObjectMapper.Builder builder) {
    builder
            .add(new DateFieldMapper.Builder("dateTime"))
            .add(new FloatFieldMapper.Builder("temperature"))
            .add(new FloatFieldMapper.Builder("windSpeed"))
            .add(new FloatFieldMapper.Builder("stationPressure"))
            .add(new StringFieldMapper.Builder("skyCondition"))
            .add(new ObjectMapper.Builder("station")
                    .add(new StringFieldMapper.Builder("wban"))
                    .add(new StringFieldMapper.Builder("name"))
                    .add(new StringFieldMapper.Builder("state"))
                    .add(new StringFieldMapper.Builder("location"))
                    .add(new GeoPointFieldMapper.Builder("coordinates")
                            .enableLatLon(true)
                            .enableGeoHash(false))
                    .nested(ObjectMapper.Nested.newNested(true, false)));
}
 
Example 4
Source File: MapperBuilders.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public static DocumentMapper.Builder doc(RootObjectMapper.Builder objectBuilder, MapperService mapperService) {
    return new DocumentMapper.Builder(objectBuilder, mapperService);
}
 
Example 5
Source File: MapperBuilders.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public static RootObjectMapper.Builder rootObject(String name) {
    return new RootObjectMapper.Builder(name);
}
 
Example 6
Source File: BaseElasticSearchMapping.java    From ElasticUtils with MIT License 3 votes vote down vote up
private RootObjectMapper.Builder getRootObjectBuilder() {
    RootObjectMapper.Builder rootObjectMapperBuilder = new RootObjectMapper.Builder(indexType);

    configureRootObjectBuilder(rootObjectMapperBuilder);

    return rootObjectMapperBuilder;
}
 
Example 7
Source File: BaseElasticSearchMapping.java    From ElasticUtils with MIT License votes vote down vote up
protected abstract void configureRootObjectBuilder(RootObjectMapper.Builder builder);