org.elasticsearch.index.mapper.core.StringFieldMapper Java Examples
The following examples show how to use
org.elasticsearch.index.mapper.core.StringFieldMapper.
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: MapperTestUtils.java From elasticsearch-analysis-baseform with Apache License 2.0 | 6 votes |
private static Map<String, Mapper.TypeParser> registerBuiltInMappers() { Map<String, Mapper.TypeParser> mapperParsers = new LinkedHashMap<>(); mapperParsers.put(ByteFieldMapper.CONTENT_TYPE, new ByteFieldMapper.TypeParser()); mapperParsers.put(ShortFieldMapper.CONTENT_TYPE, new ShortFieldMapper.TypeParser()); mapperParsers.put(IntegerFieldMapper.CONTENT_TYPE, new IntegerFieldMapper.TypeParser()); mapperParsers.put(LongFieldMapper.CONTENT_TYPE, new LongFieldMapper.TypeParser()); mapperParsers.put(FloatFieldMapper.CONTENT_TYPE, new FloatFieldMapper.TypeParser()); mapperParsers.put(DoubleFieldMapper.CONTENT_TYPE, new DoubleFieldMapper.TypeParser()); mapperParsers.put(BooleanFieldMapper.CONTENT_TYPE, new BooleanFieldMapper.TypeParser()); mapperParsers.put(BinaryFieldMapper.CONTENT_TYPE, new BinaryFieldMapper.TypeParser()); mapperParsers.put(DateFieldMapper.CONTENT_TYPE, new DateFieldMapper.TypeParser()); mapperParsers.put(IpFieldMapper.CONTENT_TYPE, new IpFieldMapper.TypeParser()); mapperParsers.put(StringFieldMapper.CONTENT_TYPE, new StringFieldMapper.TypeParser()); mapperParsers.put(TokenCountFieldMapper.CONTENT_TYPE, new TokenCountFieldMapper.TypeParser()); mapperParsers.put(ObjectMapper.CONTENT_TYPE, new ObjectMapper.TypeParser()); mapperParsers.put(ObjectMapper.NESTED_CONTENT_TYPE, new ObjectMapper.TypeParser()); mapperParsers.put(TypeParsers.MULTI_FIELD_CONTENT_TYPE, TypeParsers.multiFieldConverterTypeParser); mapperParsers.put(CompletionFieldMapper.CONTENT_TYPE, new CompletionFieldMapper.TypeParser()); mapperParsers.put(GeoPointFieldMapper.CONTENT_TYPE, new GeoPointFieldMapper.TypeParser()); return mapperParsers; }
Example #2
Source File: QueryParseContext.java From Elasticsearch with Apache License 2.0 | 6 votes |
private MappedFieldType failIfFieldMappingNotFound(String name, MappedFieldType fieldMapping) { if (fieldMapping != null || allowUnmappedFields) { return fieldMapping; } else if (mapUnmappedFieldAsString){ StringFieldMapper.Builder builder = MapperBuilders.stringField(name); // it would be better to pass the real index settings, but they are not easily accessible from here... Settings settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, indexQueryParser.getIndexCreatedVersion()).build(); return builder.build(new Mapper.BuilderContext(settings, new ContentPath(1))).fieldType(); } else { Version indexCreatedVersion = indexQueryParser.getIndexCreatedVersion(); if (fieldMapping == null && indexCreatedVersion.onOrAfter(Version.V_1_4_0_Beta1)) { throw new QueryParsingException(this, "Strict field resolution and no field mapping can be found for the field with name [" + name + "]"); } else { return fieldMapping; } } }
Example #3
Source File: LocalWeatherDataMapper.java From JavaElasticSearchExperiment with MIT License | 6 votes |
@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: LocalWeatherDataMapper.java From ElasticUtils with MIT License | 6 votes |
@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 #5
Source File: BaseGeoPointFieldMapper.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public FieldMapper updateFieldType(Map<String, MappedFieldType> fullNameToFieldType) { BaseGeoPointFieldMapper updated = (BaseGeoPointFieldMapper) super.updateFieldType(fullNameToFieldType); StringFieldMapper geoUpdated = geoHashMapper == null ? null : (StringFieldMapper) geoHashMapper.updateFieldType(fullNameToFieldType); DoubleFieldMapper latUpdated = latMapper == null ? null : (DoubleFieldMapper) latMapper.updateFieldType(fullNameToFieldType); DoubleFieldMapper lonUpdated = lonMapper == null ? null : (DoubleFieldMapper) lonMapper.updateFieldType(fullNameToFieldType); if (updated == this && geoUpdated == geoHashMapper && latUpdated == latMapper && lonUpdated == lonMapper) { return this; } if (updated == this) { updated = (BaseGeoPointFieldMapper) updated.clone(); } updated.geoHashMapper = geoUpdated; updated.latMapper = latUpdated; updated.lonMapper = lonUpdated; return updated; }
Example #6
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
/** * Parse the mapping definition for the ontology type. * * @param name the field name * @param node the JSON node holding the mapping definitions. * @param parserContext the parser context object. * @return a Builder for an OntologyMapper. */ @SuppressWarnings("unchecked") @Override public Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { OntologySettings ontologySettings = null; Builder builder = new Builder(name); parseField(builder, name, node, parserContext); for (Iterator<Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext(); ) { Entry<String, Object> entry = iterator.next(); if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) { ontologySettings = new OntologySettingsBuilder() .settingsNode((Map<String, Object>) entry.getValue()) .build(); iterator.remove(); } else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) { Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext); builder = builder.propertyBuilders(builders); iterator.remove(); } } if (ontologySettings == null) { throw new MapperParsingException("No ontology settings supplied"); } else if (StringUtils.isBlank(ontologySettings.getOntologyUri()) && StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) { throw new MapperParsingException("No ontology URI or OLS details supplied"); } else { builder = builder.ontologySettings(ontologySettings); } return builder; }
Example #7
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private void addRelatedNodesWithLabels(ParseContext context, Collection<String> iris, StringFieldMapper iriMapper, Collection<String> labels, StringFieldMapper labelMapper) throws IOException { if (!iris.isEmpty()) { addFieldData(context, iriMapper, iris); addFieldData(context, labelMapper, labels); } }
Example #8
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
@Override public void doMerge(Mapper mergeWith, boolean includeInAll) throws MergeMappingException { super.doMerge(mergeWith, includeInAll); OntologyMapper oMergeWith = (OntologyMapper) mergeWith; OntologySettings mergeSettings = oMergeWith.ontologySettings; if (mergeSettings.getOntologyUri() != null && !mergeSettings.getOntologyUri().equals(ontologySettings.getOntologyUri())) { throw new IllegalArgumentException("mapper [" + fieldType().names().fullName() + "] has different ontology URI"); } else if (mergeSettings.getOlsBaseUrl() != null && !mergeSettings.getOlsBaseUrl().equals(ontologySettings.getOlsBaseUrl())) { throw new IllegalArgumentException("mapper [" + fieldType().names().fullName() + "] has different OLS base URL"); } // Merge the mappers List<FieldMapper> newFieldMappers = null; Map<String, StringFieldMapper> newMapperMap = null; for (Entry<String, StringFieldMapper> entry : oMergeWith.mappers.entrySet()) { StringFieldMapper mergeIntoMapper = mappers.get(entry.getKey()); if (mergeIntoMapper == null) { if (newFieldMappers == null) { newFieldMappers = new ArrayList<>(oMergeWith.mappers.size()); newMapperMap = new HashMap<>(); } newFieldMappers.add(entry.getValue()); newMapperMap.put(entry.getKey(), entry.getValue()); } else { mergeIntoMapper.merge(entry.getValue(), includeInAll); } } if (newFieldMappers != null) { mappers = mappers.copyAndPutAll(newMapperMap); } }
Example #9
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
@Override public OntologyMapper build(BuilderContext context) { ContentPath.Type origPathType = context.path().pathType(); context.path().pathType(pathType); Map<String, FieldMapper<String>> fieldMappers = Maps.newHashMap(); context.path().add(name); if (propertyBuilders != null) { for (String property : propertyBuilders.keySet()) { StringFieldMapper sfm = propertyBuilders.get(property).build(context); fieldMappers.put(sfm.names().indexName(), sfm); } } // Initialise field mappers for the pre-defined fields for (FieldMappings mapping : ontologySettings.getFieldMappings()) { if (!fieldMappers.containsKey(context.path().fullPathAsText(mapping.getFieldName()))) { StringFieldMapper mapper = MapperBuilders.stringField(mapping.getFieldName()) .store(true) .index(true) .tokenized(!mapping.isUriField()) .build(context); fieldMappers.put(mapper.names().indexName(), mapper); } } context.path().remove(); // remove name context.path().pathType(origPathType); return new OntologyMapper(buildNames(context), fieldType, docValues, indexAnalyzer, searchAnalyzer, postingsProvider, docValuesProvider, similarity, fieldDataSettings, context.indexSettings(), new MultiFields.Builder().build(this, context), ontologySettings, fieldMappers, threadPool); }
Example #10
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
/** * Parse the mapping definition for the ontology type. * * @param name the field name * @param node the JSON node holding the mapping definitions. * @param parserContext the parser context object. * @return a Builder for an OntologyMapper. */ @SuppressWarnings("unchecked") @Override public Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { OntologySettings ontologySettings = null; Builder builder = new Builder(name, threadPool); for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext(); ) { Entry<String, Object> entry = iterator.next(); if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) { ontologySettings = new OntologySettingsBuilder() .settingsNode((Map<String, Object>) entry.getValue()) .build(); iterator.remove(); } else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) { Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext); builder.propertyBuilders(builders); iterator.remove(); } } if (ontologySettings == null) { throw new MapperParsingException("No ontology settings supplied"); } else if (StringUtils.isBlank(ontologySettings.getOntologyUri()) && StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) { throw new MapperParsingException("No ontology URI or OLS details supplied"); } else { builder = builder.ontologySettings(ontologySettings); } return builder; }
Example #11
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) { Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>(); for (Iterator<Map.Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext(); ) { Entry<String, Object> entry = iterator.next(); String name = entry.getKey(); @SuppressWarnings("unchecked") Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>) entry.getValue(), parserContext); propertyMap.put(name, (StringFieldMapper.Builder) builder); } return propertyMap; }
Example #12
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
@Override public OntologyMapper build(BuilderContext context) { ContentPath.Type origPathType = context.path().pathType(); context.path().pathType(pathType); Map<String, FieldMapper<String>> fieldMappers = Maps.newHashMap(); context.path().add(name); if (propertyBuilders != null) { for (String property : propertyBuilders.keySet()) { StringFieldMapper sfm = propertyBuilders.get(property).build(context); fieldMappers.put(sfm.names().indexName(), sfm); } } // Initialise field mappers for the pre-defined fields for (FieldMappings mapping : ontologySettings.getFieldMappings()) { if (!fieldMappers.containsKey(context.path().fullPathAsText(mapping.getFieldName()))) { StringFieldMapper mapper = MapperBuilders.stringField(mapping.getFieldName()) .store(true) .index(true) .tokenized(!mapping.isUriField()) .build(context); fieldMappers.put(mapper.names().indexName(), mapper); } } context.path().remove(); // remove name context.path().pathType(origPathType); return new OntologyMapper(buildNames(context), fieldType, docValues, indexAnalyzer, searchAnalyzer, postingsProvider, docValuesProvider, similarity, fieldDataSettings, context.indexSettings(), new MultiFields.Builder().build(this, context), ontologySettings, fieldMappers, threadPool); }
Example #13
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
/** * Parse the mapping definition for the ontology type. * * @param name the field name * @param node the JSON node holding the mapping definitions. * @param parserContext the parser context * @return a Builder for an OntologyMapper. */ @SuppressWarnings("unchecked") @Override public Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { OntologySettings ontologySettings = null; Builder builder = new Builder(name, threadPool); for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) { Entry<String, Object> entry = iterator.next(); if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) { ontologySettings = new OntologySettingsBuilder() .settingsNode((Map<String, Object>) entry.getValue()) .build(); iterator.remove(); } else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) { Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext); builder.propertyBuilders(builders); iterator.remove(); } } if (ontologySettings == null) { throw new MapperParsingException("No ontology settings supplied"); } else if (StringUtils.isBlank(ontologySettings.getOntologyUri()) && StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) { throw new MapperParsingException("No ontology URI or OLS details supplied"); } else { builder = builder.ontologySettings(ontologySettings); } return builder; }
Example #14
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) { Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>(); for (Iterator<Map.Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext();) { Entry<String, Object> entry = iterator.next(); String name = entry.getKey(); @SuppressWarnings("unchecked") Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>)entry.getValue(), parserContext); propertyMap.put(name, (StringFieldMapper.Builder)builder); } return propertyMap; }
Example #15
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
@Override public OntologyMapper build(BuilderContext context) { ContentPath.Type origPathType = context.path().pathType(); context.path().pathType(pathType); Map<String, StringFieldMapper> fieldMappers = new HashMap<>(); context.path().add(name); if (propertyBuilders != null) { for (String property : propertyBuilders.keySet()) { StringFieldMapper sfm = propertyBuilders.get(property).build(context); fieldMappers.put(sfm.fieldType().names().indexName(), sfm); } } // Initialise field mappers for the pre-defined fields for (FieldMappings mapping : ontologySettings.getFieldMappings()) { if (!fieldMappers.containsKey(context.path().fullPathAsText(mapping.getFieldName()))) { StringFieldMapper mapper = MapperBuilders.stringField(mapping.getFieldName()) .store(true) .index(true) .tokenized(!mapping.isUriField()) .includeInAll(true) .build(context); fieldMappers.put(mapper.fieldType().names().indexName(), mapper); } } context.path().remove(); // remove name context.path().pathType(origPathType); setupFieldType(context); return new OntologyMapper(name, fieldType, defaultFieldType, context.indexSettings(), multiFieldsBuilder.build(this, context), ontologySettings, fieldMappers); }
Example #16
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) { Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>(); for (Iterator<Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext();) { Entry<String, Object> entry = iterator.next(); String name = entry.getKey(); @SuppressWarnings("unchecked") Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>)entry.getValue(), parserContext); propertyMap.put(name, (StringFieldMapper.Builder)builder); } return propertyMap; }
Example #17
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private Map<String, StringFieldMapper.Builder> parseProperties(Map<String, Object> propertiesNode, ParserContext parserContext) { Map<String, StringFieldMapper.Builder> propertyMap = new HashMap<>(); for (Iterator<Entry<String, Object>> iterator = propertiesNode.entrySet().iterator(); iterator.hasNext(); ) { Entry<String, Object> entry = iterator.next(); String name = entry.getKey(); @SuppressWarnings("unchecked") Mapper.Builder builder = new StringFieldMapper.TypeParser().parse(entry.getKey(), (Map<String, Object>) entry.getValue(), parserContext); propertyMap.put(name, (StringFieldMapper.Builder) builder); } return propertyMap; }
Example #18
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private void addRelatedNodesWithLabels(ParseContext context, Collection<String> iris, StringFieldMapper iriMapper, Collection<String> labels, StringFieldMapper labelMapper) throws IOException { if (!iris.isEmpty()) { addFieldData(context, iriMapper, iris); addFieldData(context, labelMapper, labels); } }
Example #19
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private void addFieldData(ParseContext context, StringFieldMapper mapper, Collection<String> data) throws IOException { if (data != null && !data.isEmpty()) { for (String value : data) { ParseContext evc = context.createExternalValueContext(value); mapper.parse(evc); } } }
Example #20
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
public OntologyMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings, MultiFields multiFields, OntologySettings oSettings, Map<String, StringFieldMapper> fieldMappers) { super(simpleName, fieldType, defaultFieldType, indexSettings, multiFields, null); this.ontologySettings = oSettings; // Dynamic mappers are added to mappers map as they are used/created this.mappers = CopyOnWriteHashMap.copyOf(fieldMappers); }
Example #21
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private void addFieldData(ParseContext context, StringFieldMapper mapper, Collection<String> data) throws IOException { if (data != null && !data.isEmpty()) { for (String value : data) { ParseContext evc = context.createExternalValueContext(value); mapper.parse(evc); } } }
Example #22
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
private void addRelatedNodesWithLabels(ParseContext context, Collection<String> iris, StringFieldMapper iriMapper, Collection<String> labels, StringFieldMapper labelMapper) throws IOException { if (!iris.isEmpty()) { addFieldData(context, iriMapper, iris); addFieldData(context, labelMapper, labels); } }
Example #23
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
@Override public OntologyMapper build(BuilderContext context) { ContentPath.Type origPathType = context.path().pathType(); context.path().pathType(pathType); Map<String, StringFieldMapper> fieldMappers = new HashMap<>(); context.path().add(name); if (propertyBuilders != null) { for (String property : propertyBuilders.keySet()) { StringFieldMapper sfm = propertyBuilders.get(property).build(context); fieldMappers.put(sfm.fieldType().names().indexName(), sfm); } } // Initialise field mappers for the pre-defined fields for (FieldMappings mapping : ontologySettings.getFieldMappings()) { if (!fieldMappers.containsKey(context.path().fullPathAsText(mapping.getFieldName()))) { StringFieldMapper mapper = MapperBuilders.stringField(mapping.getFieldName()) .store(true) .index(true) .tokenized(!mapping.isUriField()) .build(context); fieldMappers.put(mapper.fieldType().names().indexName(), mapper); } } context.path().remove(); // remove name context.path().pathType(origPathType); setupFieldType(context); return new OntologyMapper(name, fieldType, defaultFieldType, context.indexSettings(), multiFieldsBuilder.build(this, context), ontologySettings, fieldMappers, threadPool); }
Example #24
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
/** * Parse the mapping definition for the ontology type. * * @param name the field name * @param node the JSON node holding the mapping definitions. * @param parserContext the parser context object. * @return a Builder for an OntologyMapper. */ @SuppressWarnings("unchecked") @Override public Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { OntologySettings ontologySettings = null; Builder builder = new Builder(name, threadPool); parseField(builder, name, node, parserContext); for (Iterator<Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) { Entry<String, Object> entry = iterator.next(); if (entry.getKey().equals(OntologySettings.ONTOLOGY_SETTINGS_KEY)) { ontologySettings = new OntologySettingsBuilder() .settingsNode((Map<String, Object>) entry.getValue()) .build(); iterator.remove(); } else if (entry.getKey().equals(ONTOLOGY_PROPERTIES)) { Map<String, StringFieldMapper.Builder> builders = parseProperties((Map<String, Object>) entry.getValue(), parserContext); builder = builder.propertyBuilders(builders); iterator.remove(); } } if (ontologySettings == null) { throw new MapperParsingException("No ontology settings supplied"); } else if (StringUtils.isBlank(ontologySettings.getOntologyUri()) && StringUtils.isBlank(ontologySettings.getOlsBaseUrl())) { throw new MapperParsingException("No ontology URI or OLS details supplied"); } else { builder = builder.ontologySettings(ontologySettings); } return builder; }
Example #25
Source File: OntologyMapper.java From BioSolr with Apache License 2.0 | 5 votes |
public OntologyMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings, MultiFields multiFields, OntologySettings oSettings, Map<String, StringFieldMapper> fieldMappers, ThreadPool threadPool) { super(simpleName, fieldType, defaultFieldType, indexSettings, multiFields, null); this.ontologySettings = oSettings; // Dynamic mappers are added to mappers map as they are used/created this.mappers = CopyOnWriteHashMap.copyOf(fieldMappers); this.threadPool = threadPool; }
Example #26
Source File: ShardTermVectorsService.java From Elasticsearch with Apache License 2.0 | 5 votes |
private boolean isValidField(MappedFieldType fieldType) { // must be a string if (!(fieldType instanceof StringFieldMapper.StringFieldType)) { return false; } // and must be indexed if (fieldType.indexOptions() == IndexOptions.NONE) { return false; } return true; }
Example #27
Source File: GeoPointFieldMapper.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public GeoPointFieldMapper build(BuilderContext context, String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings, ContentPath.Type pathType, DoubleFieldMapper latMapper, DoubleFieldMapper lonMapper, StringFieldMapper geoHashMapper, MultiFields multiFields, Explicit<Boolean> ignoreMalformed, CopyTo copyTo) { fieldType.setTokenized(false); if (context.indexCreatedVersion().before(Version.V_2_3_0)) { fieldType.setNumericPrecisionStep(GeoPointField.PRECISION_STEP); fieldType.setNumericType(FieldType.NumericType.LONG); } setupFieldType(context); return new GeoPointFieldMapper(simpleName, fieldType, defaultFieldType, indexSettings, pathType, latMapper, lonMapper, geoHashMapper, multiFields, ignoreMalformed, copyTo); }
Example #28
Source File: GeoPointFieldMapperLegacy.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public GeoPointFieldMapperLegacy build(BuilderContext context, String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings, ContentPath.Type pathType, DoubleFieldMapper latMapper, DoubleFieldMapper lonMapper, StringFieldMapper geoHashMapper, MultiFields multiFields, Explicit<Boolean> ignoreMalformed, CopyTo copyTo) { fieldType.setTokenized(false); setupFieldType(context); fieldType.setHasDocValues(false); defaultFieldType.setHasDocValues(false); return new GeoPointFieldMapperLegacy(simpleName, fieldType, defaultFieldType, indexSettings, pathType, latMapper, lonMapper, geoHashMapper, multiFields, ignoreMalformed, coerce(context), copyTo); }
Example #29
Source File: GeoPointFieldMapperLegacy.java From Elasticsearch with Apache License 2.0 | 5 votes |
public GeoPointFieldMapperLegacy(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings, ContentPath.Type pathType, DoubleFieldMapper latMapper, DoubleFieldMapper lonMapper, StringFieldMapper geoHashMapper, MultiFields multiFields, Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce, CopyTo copyTo) { super(simpleName, fieldType, defaultFieldType, indexSettings, pathType, latMapper, lonMapper, geoHashMapper, multiFields, ignoreMalformed, copyTo); this.coerce = coerce; }
Example #30
Source File: BaseGeoPointFieldMapper.java From Elasticsearch with Apache License 2.0 | 5 votes |
protected BaseGeoPointFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType, Settings indexSettings, ContentPath.Type pathType, DoubleFieldMapper latMapper, DoubleFieldMapper lonMapper, StringFieldMapper geoHashMapper, MultiFields multiFields, Explicit<Boolean> ignoreMalformed, CopyTo copyTo) { super(simpleName, fieldType, defaultFieldType, indexSettings, multiFields, copyTo); this.pathType = pathType; this.latMapper = latMapper; this.lonMapper = lonMapper; this.geoHashMapper = geoHashMapper; this.ignoreMalformed = ignoreMalformed; }