|
|
@@ -40,15 +40,20 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|
|
import org.elasticsearch.index.Index;
|
|
|
import org.elasticsearch.index.IndexSettings;
|
|
|
import org.elasticsearch.index.IndexSortConfig;
|
|
|
+import org.elasticsearch.index.analysis.FieldNameAnalyzer;
|
|
|
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
|
|
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
|
|
|
import org.elasticsearch.index.fielddata.IndexFieldData;
|
|
|
import org.elasticsearch.index.mapper.ContentPath;
|
|
|
+import org.elasticsearch.index.mapper.DocumentMapper;
|
|
|
import org.elasticsearch.index.mapper.FieldMapper;
|
|
|
import org.elasticsearch.index.mapper.MappedFieldType;
|
|
|
import org.elasticsearch.index.mapper.Mapper;
|
|
|
+import org.elasticsearch.index.mapper.MapperParsingException;
|
|
|
import org.elasticsearch.index.mapper.MapperService;
|
|
|
import org.elasticsearch.index.mapper.ObjectMapper;
|
|
|
+import org.elasticsearch.index.mapper.ParsedDocument;
|
|
|
+import org.elasticsearch.index.mapper.SourceToParse;
|
|
|
import org.elasticsearch.index.mapper.TextFieldMapper;
|
|
|
import org.elasticsearch.index.query.support.NestedScope;
|
|
|
import org.elasticsearch.index.similarity.SimilarityService;
|
|
|
@@ -216,6 +221,23 @@ public class QueryShardContext extends QueryRewriteContext {
|
|
|
return Map.copyOf(namedQueries);
|
|
|
}
|
|
|
|
|
|
+ public ParsedDocument parseDocument(SourceToParse source) throws MapperParsingException {
|
|
|
+ return mapperService.documentMapper() == null ? null : mapperService.documentMapper().parse(source);
|
|
|
+ }
|
|
|
+
|
|
|
+ public FieldNameAnalyzer getFieldNameIndexAnalyzer() {
|
|
|
+ DocumentMapper documentMapper = mapperService.documentMapper();
|
|
|
+ return documentMapper == null ? null : documentMapper.mappers().indexAnalyzer();
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean hasNested() {
|
|
|
+ return mapperService.hasNested();
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean hasMappings() {
|
|
|
+ return mapperService.documentMapper() != null;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns all the fields that match a given pattern. If prefixed with a
|
|
|
* type then the fields will be returned with a type prefix.
|
|
|
@@ -467,13 +489,6 @@ public class QueryShardContext extends QueryRewriteContext {
|
|
|
return indexSettings;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Return the MapperService.
|
|
|
- */
|
|
|
- public MapperService getMapperService() {
|
|
|
- return mapperService;
|
|
|
- }
|
|
|
-
|
|
|
/** Return the current {@link IndexReader}, or {@code null} if no index reader is available,
|
|
|
* for instance if this rewrite context is used to index queries (percolation). */
|
|
|
public IndexReader getIndexReader() {
|