- All Implemented Interfaces:
 NamedWriteable,VersionedNamedWriteable,Writeable,QueryBuilder,Rewriteable<QueryBuilder>,ToXContent,ToXContentObject
field(String), will run the query once and non prefixed fields
 will use the defaultField(String) set. The second, when one or more fields are added
 (using field(String)), will run the parsed query against the provided fields, and combine
 them using Dismax.- 
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> - 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final booleanstatic final booleanstatic final ParseFieldstatic final Fuzzinessstatic final intstatic final intstatic final booleanstatic final intstatic final Operatorstatic final ParseFieldstatic final intstatic final MultiMatchQueryBuilder.Typestatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final Stringstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldstatic final ParseFieldFields inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
boost, DEFAULT_BOOST, NAME_FIELD, queryNameFields inherited from interface org.elasticsearch.index.query.Rewriteable
MAX_REWRITE_ROUNDSFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionallowLeadingWildcard(Boolean allowLeadingWildcard) Should leading wildcards be allowed or not.analyzer()The optional analyzer used to analyze the query string.The optional analyzer used to analyze the query string.analyzeWildcard(Boolean analyzeWildcard) Set totrueto enable analysis on wildcard and prefix queries.booleanWhether phrase queries should be automatically generated for multi terms synonyms.autoGenerateSynonymsPhraseQuery(boolean value) defaultField(String defaultField) The default field to run against when no prefix field is specified.defaultOperator(Operator defaultOperator) Sets the boolean operator of the query parser used to parse the query string.protected booleandoEquals(QueryStringQueryBuilder other) Indicates whether some otherQueryBuilderobject of the same type is "equal to" this one.protected intprotected org.apache.lucene.search.QuerydoToQuery(SearchExecutionContext context) protected voiddoWriteTo(StreamOutput out) protected voiddoXContent(XContentBuilder builder, ToXContent.Params params) booleanenablePositionIncrements(boolean enablePositionIncrements) Set totrueto enable position increments in result query.booleanescape()escape(boolean escape) Set totrueto enable escaping of the query stringAdds a field to run the query string against.Adds a field to run the query string against with a specific boost.fields()Returns the fields including their respective boosts to run the query against.Add several fields to run the query against with a specific boost.static QueryStringQueryBuilderfromXContent(XContentParser parser) Set the edit distance for fuzzy queries.intfuzzyMaxExpansions(int fuzzyMaxExpansions) intfuzzyPrefixLength(int fuzzyPrefixLength) Set the minimum prefix length for fuzzy queries.fuzzyRewrite(String fuzzyRewrite) booleanfuzzyTranspositions(boolean fuzzyTranspositions) Sets whether transpositions are supported in fuzzy queries.The minimal version of the recipient this object can be sent toReturns the name of the writeable objectlenient()Sets the query string parser to be lenient when parsing field values, defaults to the index setting and if not set, defaults to false.intmaxDeterminizedStates(int maxDeterminizedStates) Protects against too-difficult regular expression queries.minimumShouldMatch(String minimumShouldMatch) intphraseSlop(int phraseSlop) Sets the default slop for phrases.The optional analyzer used to analyze the query string for phrase searches.quoteAnalyzer(String quoteAnalyzer) The optional analyzer used to analyze the query string for phrase searches.quoteFieldSuffix(String quoteFieldSuffix) An optional field name suffix to automatically try and add to the field searched when using quoted text.rewrite()tieBreaker(float tieBreaker) When more than one field is used with the query string, and combined queries are using dis max, control the tie breaker for it.timeZone()In case of date field, we can adjust the from/to fields using a timezoneMethods inherited from class org.elasticsearch.index.query.AbstractQueryBuilder
addValidationError, boost, boost, boostAndQueryNameToXContent, checkNegativeBoost, declareStandardFields, doCoordinatorRewrite, doIndexMetadataRewrite, doInnerHitsRewrite, doRewrite, doSearchRewrite, equals, extractInnerHitBuilders, getMaxNestedDepth, getName, hashCode, parseInnerQueryBuilder, parseTopLevelQuery, parseTopLevelQuery, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, setMaxNestedDepth, throwParsingExceptionOnMultipleFields, toQuery, toString, toXContent, writeQueries, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment 
- 
Field Details
- 
NAME
- See Also:
 
 - 
DEFAULT_MAX_DETERMINED_STATES
public static final int DEFAULT_MAX_DETERMINED_STATES- See Also:
 
 - 
DEFAULT_ENABLE_POSITION_INCREMENTS
public static final boolean DEFAULT_ENABLE_POSITION_INCREMENTS- See Also:
 
 - 
DEFAULT_ESCAPE
public static final boolean DEFAULT_ESCAPE- See Also:
 
 - 
DEFAULT_FUZZY_PREFIX_LENGTH
public static final int DEFAULT_FUZZY_PREFIX_LENGTH- See Also:
 
 - 
DEFAULT_FUZZY_MAX_EXPANSIONS
public static final int DEFAULT_FUZZY_MAX_EXPANSIONS- See Also:
 
 - 
DEFAULT_PHRASE_SLOP
public static final int DEFAULT_PHRASE_SLOP- See Also:
 
 - 
DEFAULT_FUZZINESS
 - 
DEFAULT_OPERATOR
 - 
DEFAULT_TYPE
 - 
DEFAULT_FUZZY_TRANSPOSITIONS
public static final boolean DEFAULT_FUZZY_TRANSPOSITIONS- See Also:
 
 - 
QUERY_FIELD
 - 
BOOST_FIELD
 - 
FIELDS_FIELD
 - 
DEFAULT_FIELD_FIELD
 - 
DEFAULT_OPERATOR_FIELD
 - 
ANALYZER_FIELD
 - 
QUOTE_ANALYZER_FIELD
 - 
ALLOW_LEADING_WILDCARD_FIELD
 - 
MAX_DETERMINIZED_STATES_FIELD
 - 
ENABLE_POSITION_INCREMENTS_FIELD
 - 
ESCAPE_FIELD
 - 
FUZZINESS_FIELD
 - 
FUZZY_PREFIX_LENGTH_FIELD
 - 
FUZZY_MAX_EXPANSIONS_FIELD
 - 
FUZZY_REWRITE_FIELD
 - 
PHRASE_SLOP_FIELD
 - 
TIE_BREAKER_FIELD
 - 
ANALYZE_WILDCARD_FIELD
 - 
REWRITE_FIELD
 - 
MINIMUM_SHOULD_MATCH_FIELD
 - 
QUOTE_FIELD_SUFFIX_FIELD
 - 
LENIENT_FIELD
 - 
TIME_ZONE_FIELD
 - 
TYPE_FIELD
 - 
GENERATE_SYNONYMS_PHRASE_QUERY
 - 
FUZZY_TRANSPOSITIONS_FIELD
 
 - 
 - 
Constructor Details
- 
QueryStringQueryBuilder
 - 
QueryStringQueryBuilder
Read from a stream.- Throws:
 IOException
 
 - 
 - 
Method Details
- 
doWriteTo
- Specified by:
 doWriteToin classAbstractQueryBuilder<QueryStringQueryBuilder>- Throws:
 IOException
 - 
queryString
 - 
defaultField
The default field to run against when no prefix field is specified. Only relevant when not explicitly adding fields the query string will run against. - 
defaultField
 - 
field
Adds a field to run the query string against. The field will be associated with the default boost ofAbstractQueryBuilder.DEFAULT_BOOST. Usefield(String, float)to set a specific boost for the field. - 
field
Adds a field to run the query string against with a specific boost. - 
fields
Add several fields to run the query against with a specific boost. - 
fields
Returns the fields including their respective boosts to run the query against. - 
type
- Parameters:
 type- Sets how multiple fields should be combined to build textual part queries.
 - 
tieBreaker
When more than one field is used with the query string, and combined queries are using dis max, control the tie breaker for it. - 
tieBreaker
 - 
defaultOperator
Sets the boolean operator of the query parser used to parse the query string.In default mode (
Operator.OR) terms without any modifiers are considered optional: for examplecapital of Hungaryis equal tocapital OR of OR Hungary.In
Operator.ANDmode terms are considered to be in conjunction: the above mentioned query is parsed ascapital AND of AND Hungary - 
defaultOperator
 - 
analyzer
The optional analyzer used to analyze the query string. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer. - 
analyzer
The optional analyzer used to analyze the query string. Note, if a field has search analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer. - 
quoteAnalyzer
The optional analyzer used to analyze the query string for phrase searches. Note, if a field has search (quote) analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer. - 
quoteAnalyzer
The optional analyzer used to analyze the query string for phrase searches. Note, if a field has search (quote) analyzer defined for it, then it will be used automatically. Defaults to the smart search analyzer. - 
maxDeterminizedStates
Protects against too-difficult regular expression queries. - 
maxDeterminizedStates
public int maxDeterminizedStates() - 
allowLeadingWildcard
Should leading wildcards be allowed or not. Defaults totrue. - 
allowLeadingWildcard
 - 
enablePositionIncrements
Set totrueto enable position increments in result query. Defaults totrue.When set, result phrase and multi-phrase queries will be aware of position increments. Useful when e.g. a StopFilter increases the position increment of the token that follows an omitted token.
 - 
enablePositionIncrements
public boolean enablePositionIncrements() - 
fuzziness
Set the edit distance for fuzzy queries. Default is "AUTO". - 
fuzziness
 - 
fuzzyPrefixLength
Set the minimum prefix length for fuzzy queries. Default is 1. - 
fuzzyPrefixLength
public int fuzzyPrefixLength() - 
fuzzyMaxExpansions
 - 
fuzzyMaxExpansions
public int fuzzyMaxExpansions() - 
fuzzyRewrite
 - 
fuzzyRewrite
 - 
phraseSlop
Sets the default slop for phrases. If zero, then exact phrase matches are required. Default value is zero. - 
phraseSlop
public int phraseSlop() - 
rewrite
 - 
analyzeWildcard
Set totrueto enable analysis on wildcard and prefix queries. - 
analyzeWildcard
 - 
rewrite
 - 
minimumShouldMatch
 - 
minimumShouldMatch
 - 
quoteFieldSuffix
An optional field name suffix to automatically try and add to the field searched when using quoted text. - 
quoteFieldSuffix
 - 
lenient
Sets the query string parser to be lenient when parsing field values, defaults to the index setting and if not set, defaults to false. - 
lenient
 - 
timeZone
In case of date field, we can adjust the from/to fields using a timezone - 
timeZone
 - 
timeZone
 - 
escape
Set totrueto enable escaping of the query string - 
escape
public boolean escape() - 
autoGenerateSynonymsPhraseQuery
 - 
autoGenerateSynonymsPhraseQuery
public boolean autoGenerateSynonymsPhraseQuery()Whether phrase queries should be automatically generated for multi terms synonyms. Defaults totrue. - 
fuzzyTranspositions
public boolean fuzzyTranspositions() - 
fuzzyTranspositions
Sets whether transpositions are supported in fuzzy queries.The default metric used by fuzzy queries to determine a match is the Damerau-Levenshtein distance formula which supports transpositions. Setting transposition to false will switch to classic Levenshtein distance.
If not set, Damerau-Levenshtein distance metric will be used. - 
doXContent
- Specified by:
 doXContentin classAbstractQueryBuilder<QueryStringQueryBuilder>- Throws:
 IOException
 - 
fromXContent
- Throws:
 IOException
 - 
getWriteableName
Description copied from interface:VersionedNamedWriteableReturns the name of the writeable object - 
doEquals
Description copied from class:AbstractQueryBuilderIndicates whether some otherQueryBuilderobject of the same type is "equal to" this one.- Specified by:
 doEqualsin classAbstractQueryBuilder<QueryStringQueryBuilder>
 - 
doHashCode
protected int doHashCode()- Specified by:
 doHashCodein classAbstractQueryBuilder<QueryStringQueryBuilder>
 - 
doToQuery
protected org.apache.lucene.search.Query doToQuery(SearchExecutionContext context) throws IOException - Specified by:
 doToQueryin classAbstractQueryBuilder<QueryStringQueryBuilder>- Throws:
 IOException
 - 
getMinimalSupportedVersion
Description copied from interface:VersionedNamedWriteableThe minimal version of the recipient this object can be sent to 
 -