private DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); }
private static ParsedDocument parseDocument(IndexShard indexShard, String index, String type, BytesReference doc, XContentType xContentType) { MapperService mapperService = indexShard.mapperService(); DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(type); ParsedDocument parsedDocument = docMapper.getDocumentMapper().parse(source(index, type, "_id_for_tv_api", doc, xContentType)); if (docMapper.getMapping() != null) { parsedDocument.addDynamicMappingsUpdate(docMapper.getMapping()); } return parsedDocument; }
protected DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); // protected for testing }
protected DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); // protected for testing }
private DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); }
private DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); }
private DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); }
private DocumentMapperForType docMapper(String type) { return mapperService.documentMapperWithAutoCreate(type); }
private static ParsedDocument parseDocument(IndexShard indexShard, String index, String type, BytesReference doc, XContentType xContentType) { MapperService mapperService = indexShard.mapperService(); DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(type); ParsedDocument parsedDocument = docMapper.getDocumentMapper().parse(source(index, type, "_id_for_tv_api", doc, xContentType)); if (docMapper.getMapping() != null) { parsedDocument.addDynamicMappingsUpdate(docMapper.getMapping()); } return parsedDocument; }
private static ParsedDocument parseDocument(IndexShard indexShard, String index, String type, BytesReference doc, XContentType xContentType) { MapperService mapperService = indexShard.mapperService(); DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(type); ParsedDocument parsedDocument = docMapper.getDocumentMapper().parse(source(index, type, "_id_for_tv_api", doc, xContentType)); if (docMapper.getMapping() != null) { parsedDocument.addDynamicMappingsUpdate(docMapper.getMapping()); } return parsedDocument; }
private List<ParsedDocument> parsedDocuments(IndexService documentIndexService, BatchPercolateShardRequest request, XContentParser parser) throws IOException { List<ParsedDocument> docs = new ArrayList<>(); parser.nextToken(); while ((parser.nextToken()) != XContentParser.Token.END_ARRAY) { MapperService mapperService = documentIndexService.mapperService(); Tuple<DocumentMapper, Boolean> docMapperTuple = mapperService.documentMapperWithAutoCreate(request.documentType()); BytesStreamOutput bStream = new BytesStreamOutput(); XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON, bStream); builder.copyCurrentStructure(parser); builder.close(); docs.add(getParsedDocument(documentIndexService, request, docMapperTuple.v1(), bStream)); bStream.close(); } return docs; }
private static ParsedDocument parseDocument(IndexShard indexShard, String index, String type, BytesReference doc, XContentType xContentType) { MapperService mapperService = indexShard.mapperService(); DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(type); ParsedDocument parsedDocument = docMapper.getDocumentMapper().parse(source(index, type, "_id_for_tv_api", doc, xContentType)); if (docMapper.getMapping() != null) { parsedDocument.addDynamicMappingsUpdate(docMapper.getMapping()); } return parsedDocument; }
throw new IllegalArgumentException("[percolate] query is missing required [document_type] parameter"); DocumentMapperForType docMapperForType = mapperService.documentMapperWithAutoCreate(documentType); docMapper = docMapperForType.getDocumentMapper(); for (BytesReference document : documents) {
throw new IllegalArgumentException("[percolate] query is missing required [document_type] parameter"); DocumentMapperForType docMapperForType = mapperService.documentMapperWithAutoCreate(documentType); docMapper = docMapperForType.getDocumentMapper(); for (BytesReference document : documents) {
private ParsedDocument parseDocument(String index, String type, BytesReference doc) throws Throwable { MapperService mapperService = indexShard.mapperService(); // TODO: make parsing not dynamically create fields not in the original mapping DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(type); ParsedDocument parsedDocument = docMapper.getDocumentMapper().parse(source(doc).index(index).type(type).flyweight(true)); if (docMapper.getMapping() != null) { parsedDocument.addDynamicMappingsUpdate(docMapper.getMapping()); } if (parsedDocument.dynamicMappingsUpdate() != null) { mappingUpdatedAction.updateMappingOnMasterSynchronously(index, type, parsedDocument.dynamicMappingsUpdate()); } return parsedDocument; }
final DocumentMapper docMapper = indexShard.mapperService().documentMapperWithAutoCreate(request.type()).getDocumentMapper();
Mapping update = primary.mapperService().documentMapperWithAutoCreate(request.type()).getMapping(); if (update != null) { mappingUpdateNeeded = true; Mapping update = primary.mapperService().documentMapperWithAutoCreate(request.type()).getMapping(); if (update != null) { throw new ReplicationOperation.RetryOnPrimaryException(shardId,
public static Engine.DeleteResult executeDeleteRequestOnReplica(DeleteRequest request, IndexShard replica) throws IOException { if (replica.indexSettings().isSingleType()) { // We need to wait for the replica to have the mappings Mapping update; try { update = replica.mapperService().documentMapperWithAutoCreate(request.type()).getMapping(); } catch (MapperParsingException | IllegalArgumentException e) { return new Engine.DeleteResult(e, request.version(), false); } if (update != null) { final ShardId shardId = replica.shardId(); throw new RetryOnReplicaException(shardId, "Mappings are not available on the replica yet, triggered update: " + update); } } final Engine.Delete delete = replica.prepareDeleteOnReplica(request.type(), request.id(), request.version(), request.versionType()); return replica.delete(delete); } }
private ParsedDocument parseFetchedDoc(PercolateContext context, BytesReference fetchedDoc, IndexService documentIndexService, String index, String type) { ParsedDocument doc = null; XContentParser parser = null; try { parser = XContentFactory.xContent(fetchedDoc).createParser(fetchedDoc); MapperService mapperService = documentIndexService.mapperService(); DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(type); doc = docMapper.getDocumentMapper().parse(source(parser).index(index).type(type).flyweight(true)); if (context.highlight() != null) { doc.setSource(fetchedDoc); } } catch (Throwable e) { throw new ElasticsearchParseException("failed to parse request", e); } finally { if (parser != null) { parser.close(); } } if (doc == null) { throw new ElasticsearchParseException("No doc to percolate in the request"); } return doc; }
DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(request.documentType()); doc = docMapper.getDocumentMapper().parse(source(parser).index(index).type(request.documentType()).flyweight(true)); if (docMapper.getMapping() != null) {