public DocumentMapper parse(String mappingType, CompressedXContent mappingSource, boolean applyDefault) throws MapperParsingException { return documentParser.parse(mappingType, mappingSource, applyDefault ? defaultMappingSource : null); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source) throws MapperParsingException { return parse(type, source, null); }
defaultMapper = documentParser.parse(DEFAULT_MAPPING, mappings.get(DEFAULT_MAPPING)); } catch (Exception e) { throw new MapperParsingException("Failed to parse mapping [{}]: {}", e, DEFAULT_MAPPING, e.getMessage()); documentParser.parse(type, entry.getValue(), applyDefault ? defaultMappingSourceOrLastStored : null); documentMappers.add(documentMapper); } catch (Exception e) {
public DocumentMapper parse(@Nullable String type, CompressedXContent source, String defaultSource) throws MapperParsingException { Map<String, Object> mapping = null; if (source != null) { Map<String, Object> root = XContentHelper.convertToMap(source.compressedReference(), true, XContentType.JSON).v2(); Tuple<String, Map<String, Object>> t = extractMapping(type, root); type = t.v1(); mapping = t.v2(); } if (mapping == null) { mapping = new HashMap<>(); } return parse(type, mapping, defaultSource); }
public DocumentMapper parse(String mappingType, CompressedXContent mappingSource, boolean applyDefault) throws MapperParsingException { return documentParser.parse(mappingType, mappingSource, applyDefault ? defaultMappingSource : null); }
public DocumentMapper parse(String mappingType, CompressedXContent mappingSource, boolean applyDefault) throws MapperParsingException { return documentParser.parse(mappingType, mappingSource, applyDefault ? defaultMappingSource : null); }
public DocumentMapper parse(String mappingType, CompressedXContent mappingSource, boolean applyDefault) throws MapperParsingException { String defaultMappingSource; if (PercolatorService.TYPE_NAME.equals(mappingType)) { defaultMappingSource = this.defaultPercolatorMappingSource; } else { defaultMappingSource = this.defaultMappingSource; } return documentParser.parse(mappingType, mappingSource, applyDefault ? defaultMappingSource : null); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source) throws MapperParsingException { return parse(type, source, null); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source) throws MapperParsingException { return parse(type, source, null); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source) throws MapperParsingException { return parse(type, source, null); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source) throws MapperParsingException { return parse(type, source, null); }
public void testEmptyName() throws IOException { // after version 5 for (String type : TYPES) { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("properties").startObject("").field("type", type).endObject().endObject() .endObject().endObject().string(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parser.parse("type", new CompressedXContent(mapping)) ); assertThat(e.getMessage(), containsString("name cannot be empty string")); } }
defaultMapper = documentParser.parse(DEFAULT_MAPPING, mappings.get(DEFAULT_MAPPING)); } catch (Exception e) { throw new MapperParsingException("Failed to parse mapping [{}]: {}", e, DEFAULT_MAPPING, e.getMessage()); documentParser.parse(type, entry.getValue(), applyDefault ? defaultMappingSourceOrLastStored : null); documentMappers.add(documentMapper); } catch (Exception e) {
defaultMapper = documentParser.parse(DEFAULT_MAPPING, mappings.get(DEFAULT_MAPPING)); } catch (Exception e) { throw new MapperParsingException("Failed to parse mapping [{}]: {}", e, DEFAULT_MAPPING, e.getMessage()); documentParser.parse(type, entry.getValue(), applyDefault ? defaultMappingSourceOrLastStored : null); documentMappers.add(documentMapper); } catch (Exception e) {
public DocumentMapper parse(@Nullable String type, CompressedXContent source, String defaultSource) throws MapperParsingException { Map<String, Object> mapping = null; if (source != null) { Map<String, Object> root = XContentHelper.convertToMap(source.compressedReference(), true, XContentType.JSON).v2(); Tuple<String, Map<String, Object>> t = extractMapping(type, root); type = t.v1(); mapping = t.v2(); } if (mapping == null) { mapping = new HashMap<>(); } return parse(type, mapping, defaultSource); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source, String defaultSource) throws MapperParsingException { Map<String, Object> mapping = null; if (source != null) { Map<String, Object> root = XContentHelper.convertToMap(source.compressedReference(), true, XContentType.JSON).v2(); Tuple<String, Map<String, Object>> t = extractMapping(type, root); type = t.v1(); mapping = t.v2(); } if (mapping == null) { mapping = new HashMap<>(); } return parse(type, mapping, defaultSource); }
public DocumentMapper parse(@Nullable String type, CompressedXContent source, String defaultSource) throws MapperParsingException { Map<String, Object> mapping = null; if (source != null) { Map<String, Object> root = XContentHelper.convertToMap(source.compressedReference(), true, XContentType.JSON).v2(); Tuple<String, Map<String, Object>> t = extractMapping(type, root); type = t.v1(); mapping = t.v2(); } if (mapping == null) { mapping = new HashMap<>(); } return parse(type, mapping, defaultSource); }
public DocumentMapper merge(String type, CompressedXContent mappingSource, MergeReason reason, boolean updateAllTypes) { if (DEFAULT_MAPPING.equals(type)) { // verify we can parse it // NOTE: never apply the default here DocumentMapper mapper = documentParser.parse(type, mappingSource); // still add it as a document mapper so we have it registered and, for example, persisted back into // the cluster meta data if needed, or checked for existence synchronized (this) { mappers = newMapBuilder(mappers).put(type, mapper).map(); } try { defaultMappingSource = mappingSource.string(); } catch (IOException e) { throw new ElasticsearchGenerationException("failed to un-compress", e); } return mapper; } else { synchronized (this) { final boolean applyDefault = // the default was already applied if we are recovering reason != MergeReason.MAPPING_RECOVERY // only apply the default mapping if we don't have the type yet && mappers.containsKey(type) == false; DocumentMapper mergeWith = parse(type, mappingSource, applyDefault); return merge(mergeWith, reason, updateAllTypes); } } }
public DocumentMapper parse(@Nullable String type, CompressedXContent source, String defaultSource) throws MapperParsingException { Map<String, Object> mapping = null; if (source != null) { Map<String, Object> root = XContentHelper.convertToMap(source.compressedReference(), true).v2(); Tuple<String, Map<String, Object>> t = extractMapping(type, root); type = t.v1(); mapping = t.v2(); } if (mapping == null) { mapping = Maps.newHashMap(); } return parse(type, mapping, defaultSource); }