Search in sources :

Example 1 with DocumentMapperForType

use of org.opensearch.index.mapper.DocumentMapperForType in project OpenSearch by opensearch-project.

the class TermVectorsService method parseDocument.

private static ParsedDocument parseDocument(IndexShard indexShard, String index, BytesReference doc, XContentType xContentType, String routing) {
    MapperService mapperService = indexShard.mapperService();
    DocumentMapperForType docMapper = mapperService.documentMapperWithAutoCreate(MapperService.SINGLE_MAPPING_NAME);
    ParsedDocument parsedDocument = docMapper.getDocumentMapper().parse(new SourceToParse(index, MapperService.SINGLE_MAPPING_NAME, "_id_for_tv_api", doc, xContentType, routing));
    if (docMapper.getMapping() != null) {
        parsedDocument.addDynamicMappingsUpdate(docMapper.getMapping());
    }
    return parsedDocument;
}
Also used : ParsedDocument(org.opensearch.index.mapper.ParsedDocument) DocumentMapperForType(org.opensearch.index.mapper.DocumentMapperForType) SourceToParse(org.opensearch.index.mapper.SourceToParse) MapperService(org.opensearch.index.mapper.MapperService)

Aggregations

DocumentMapperForType (org.opensearch.index.mapper.DocumentMapperForType)1 MapperService (org.opensearch.index.mapper.MapperService)1 ParsedDocument (org.opensearch.index.mapper.ParsedDocument)1 SourceToParse (org.opensearch.index.mapper.SourceToParse)1