public class QueryShardContext extends QueryRewriteContext
client, nowInMillis| Constructor | Description |
|---|---|
QueryShardContext(int shardId,
IndexSettings indexSettings,
BitsetFilterCache bitsetFilterCache,
java.util.function.BiFunction<MappedFieldType,java.lang.String,IndexFieldData<?>> indexFieldDataLookup,
MapperService mapperService,
SimilarityService similarityService,
ScriptService scriptService,
NamedXContentRegistry xContentRegistry,
NamedWriteableRegistry namedWriteableRegistry,
Client client,
org.apache.lucene.index.IndexReader reader,
java.util.function.LongSupplier nowInMillis,
java.lang.String clusterAlias) |
|
QueryShardContext(QueryShardContext source) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addNamedQuery(java.lang.String name,
org.apache.lucene.search.Query query) |
|
org.apache.lucene.search.join.BitSetProducer |
bitsetFilter(org.apache.lucene.search.Query filter) |
|
QueryShardContext |
convertToShardContext() |
Returns an instance of
QueryShardContext if available of null otherwise |
java.util.Map<java.lang.String,org.apache.lucene.search.Query> |
copyNamedQueries() |
|
java.util.List<java.lang.String> |
defaultFields() |
|
DocumentMapper |
documentMapper(java.lang.String type) |
Returns s
DocumentMapper instance for the given type. |
void |
executeAsyncActions(ActionListener listener) |
Executes all registered async actions and notifies the listener once it's done.
|
protected void |
failIfFrozen() |
This method fails if
freezeContext() is called before on this
context. |
MappedFieldType |
fieldMapper(java.lang.String name) |
|
void |
freezeContext() |
if this method is called the query context will throw exception if methods are accessed
that could yield different results across executions like
getClient() |
Client |
getClient() |
|
<IFD extends IndexFieldData<?>> |
getForField(MappedFieldType fieldType) |
|
java.lang.String |
getFullyQualifiedIndexName() |
Returns the fully qualified index name including a remote cluster alias if applicable
|
IndexAnalyzers |
getIndexAnalyzers() |
|
org.apache.lucene.index.IndexReader |
getIndexReader() |
Return the current
IndexReader, or null if no index reader is available,
for instance if this rewrite context is used to index queries (percolation). |
IndexSettings |
getIndexSettings() |
Returns the index settings for this context.
|
MapperService |
getMapperService() |
Return the MapperService.
|
ObjectMapper |
getObjectMapper(java.lang.String name) |
|
ScriptService |
getScriptService() |
Return the script service to allow compiling scripts.
|
org.apache.lucene.analysis.Analyzer |
getSearchAnalyzer(MappedFieldType fieldType) |
Gets the search analyzer for the given field, or the default if there is none present for the field
TODO: remove this by moving defaults into mappers themselves
|
org.apache.lucene.analysis.Analyzer |
getSearchQuoteAnalyzer(MappedFieldType fieldType) |
Gets the search quote analyzer for the given field, or the default if there is none present for the field
TODO: remove this by moving defaults into mappers themselves
|
org.apache.lucene.search.similarities.Similarity |
getSearchSimilarity() |
|
int |
getShardId() |
Returns the shard ID this context was created for.
|
java.lang.String[] |
getTypes() |
|
Index |
index() |
|
Version |
indexVersionCreated() |
|
boolean |
isCachable() |
Returns
true iff the result of the processed search request is cachable. |
boolean |
isFilter() |
Return whether we are currently parsing a filter or a query.
|
SearchLookup |
lookup() |
|
NestedScope |
nestedScope() |
|
long |
nowInMillis() |
Returns the time in milliseconds that is shared across all resources involved.
|
QueryBuilder |
parseInnerQueryBuilder(XContentParser parser) |
|
boolean |
queryStringAllowLeadingWildcard() |
|
boolean |
queryStringAnalyzeWildcard() |
|
boolean |
queryStringLenient() |
|
java.util.Collection<java.lang.String> |
queryTypes() |
Returns the narrowed down explicit types, or, if not set, all types.
|
void |
registerAsyncAction(java.util.function.BiConsumer<Client,ActionListener<?>> asyncAction) |
Registers an async action that must be executed before the next rewrite round in order to make progress.
|
void |
setAllowUnmappedFields(boolean allowUnmappedFields) |
|
void |
setIsFilter(boolean isFilter) |
Public for testing only!
Sets whether we are currently parsing a filter or a query
|
void |
setMapUnmappedFieldAsString(boolean mapUnmappedFieldAsString) |
|
void |
setTypes(java.lang.String... types) |
|
java.util.Collection<java.lang.String> |
simpleMatchToIndexNames(java.lang.String pattern) |
Returns all the fields that match a given pattern.
|
ParsedQuery |
toFilter(QueryBuilder queryBuilder) |
|
ParsedQuery |
toQuery(QueryBuilder queryBuilder) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetWriteableRegistry, getXContentRegistry, hasAsyncActionspublic QueryShardContext(int shardId,
IndexSettings indexSettings,
BitsetFilterCache bitsetFilterCache,
java.util.function.BiFunction<MappedFieldType,java.lang.String,IndexFieldData<?>> indexFieldDataLookup,
MapperService mapperService,
SimilarityService similarityService,
ScriptService scriptService,
NamedXContentRegistry xContentRegistry,
NamedWriteableRegistry namedWriteableRegistry,
Client client,
org.apache.lucene.index.IndexReader reader,
java.util.function.LongSupplier nowInMillis,
java.lang.String clusterAlias)
public QueryShardContext(QueryShardContext source)
public void setTypes(java.lang.String... types)
public java.lang.String[] getTypes()
public IndexAnalyzers getIndexAnalyzers()
public org.apache.lucene.search.similarities.Similarity getSearchSimilarity()
public java.util.List<java.lang.String> defaultFields()
public boolean queryStringLenient()
public boolean queryStringAnalyzeWildcard()
public boolean queryStringAllowLeadingWildcard()
public org.apache.lucene.search.join.BitSetProducer bitsetFilter(org.apache.lucene.search.Query filter)
public <IFD extends IndexFieldData<?>> IFD getForField(MappedFieldType fieldType)
public void addNamedQuery(java.lang.String name,
org.apache.lucene.search.Query query)
public java.util.Map<java.lang.String,org.apache.lucene.search.Query> copyNamedQueries()
public boolean isFilter()
public void setIsFilter(boolean isFilter)
public java.util.Collection<java.lang.String> simpleMatchToIndexNames(java.lang.String pattern)
public MappedFieldType fieldMapper(java.lang.String name)
public ObjectMapper getObjectMapper(java.lang.String name)
public DocumentMapper documentMapper(java.lang.String type)
DocumentMapper instance for the given type.
Delegates to MapperService.documentMapper(String)public org.apache.lucene.analysis.Analyzer getSearchAnalyzer(MappedFieldType fieldType)
public org.apache.lucene.analysis.Analyzer getSearchQuoteAnalyzer(MappedFieldType fieldType)
public void setAllowUnmappedFields(boolean allowUnmappedFields)
public void setMapUnmappedFieldAsString(boolean mapUnmappedFieldAsString)
public java.util.Collection<java.lang.String> queryTypes()
public SearchLookup lookup()
public NestedScope nestedScope()
public Version indexVersionCreated()
public ParsedQuery toFilter(QueryBuilder queryBuilder)
public ParsedQuery toQuery(QueryBuilder queryBuilder)
public Index index()
public final ScriptService getScriptService()
public final void freezeContext()
getClient()protected final void failIfFrozen()
freezeContext() is called before on this
context. This is used to seal.
This methods and all methods that call it should be final to ensure that
setting the request as not cacheable and the freezing behaviour of this
class cannot be bypassed. This is important so we can trust when this
class says a request can be cached.public void registerAsyncAction(java.util.function.BiConsumer<Client,ActionListener<?>> asyncAction)
QueryRewriteContextregisterAsyncAction in class QueryRewriteContextpublic void executeAsyncActions(ActionListener listener)
QueryRewriteContextnull. The list of registered actions is cleared once this method returns.executeAsyncActions in class QueryRewriteContextpublic final boolean isCachable()
true iff the result of the processed search request is cachable. Otherwise falsepublic int getShardId()
public final long nowInMillis()
QueryRewriteContextnowInMillis in class QueryRewriteContextpublic Client getClient()
public QueryBuilder parseInnerQueryBuilder(XContentParser parser) throws java.io.IOException
java.io.IOExceptionpublic final QueryShardContext convertToShardContext()
QueryRewriteContextQueryShardContext if available of null otherwiseconvertToShardContext in class QueryRewriteContextpublic IndexSettings getIndexSettings()
public MapperService getMapperService()
public org.apache.lucene.index.IndexReader getIndexReader()
IndexReader, or null if no index reader is available,
for instance if this rewrite context is used to index queries (percolation).public java.lang.String getFullyQualifiedIndexName()