|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.elasticsearch.index.query.BaseQueryBuilder org.elasticsearch.index.query.QueryStringQueryBuilder
public class QueryStringQueryBuilder
A query that parses a query string and runs it. There are two modes that this operates. The first,
when no field is added (using 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 either using DisMax or a plain boolean query (see useDisMax(boolean)
).
Nested Class Summary | |
---|---|
static class |
QueryStringQueryBuilder.Operator
|
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent |
---|
ToXContent.MapParams, ToXContent.Params |
Field Summary |
---|
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent |
---|
EMPTY_PARAMS |
Constructor Summary | |
---|---|
QueryStringQueryBuilder(String queryString)
|
Method Summary | |
---|---|
QueryStringQueryBuilder |
allowLeadingWildcard(boolean allowLeadingWildcard)
Should leading wildcards be allowed or not. |
QueryStringQueryBuilder |
analyzer(String analyzer)
The optional analyzer used to analyze the query string. |
QueryStringQueryBuilder |
analyzeWildcard(boolean analyzeWildcard)
Set to true to enable analysis on wildcard and prefix queries. |
QueryStringQueryBuilder |
autoGeneratePhraseQueries(boolean autoGeneratePhraseQueries)
Set to true if phrase queries will be automatically generated when the analyzer returns more than one term from whitespace delimited text. |
QueryStringQueryBuilder |
boost(float boost)
Sets the boost for this query. |
QueryStringQueryBuilder |
defaultField(String defaultField)
The default field to run against when no prefix field is specified. |
QueryStringQueryBuilder |
defaultOperator(QueryStringQueryBuilder.Operator defaultOperator)
Sets the boolean operator of the query parser used to parse the query string. |
protected void |
doXContent(XContentBuilder builder,
ToXContent.Params params)
|
QueryStringQueryBuilder |
enablePositionIncrements(boolean enablePositionIncrements)
Set to true to enable position increments in result query. |
QueryStringQueryBuilder |
field(String field)
Adds a field to run the query string against. |
QueryStringQueryBuilder |
field(String field,
float boost)
Adds a field to run the query string against with a specific boost. |
QueryStringQueryBuilder |
fuzzyMaxExpansions(int fuzzyMaxExpansions)
|
QueryStringQueryBuilder |
fuzzyMinSim(float fuzzyMinSim)
Set the minimum similarity for fuzzy queries. |
QueryStringQueryBuilder |
fuzzyPrefixLength(int fuzzyPrefixLength)
Set the minimum similarity for fuzzy queries. |
QueryStringQueryBuilder |
fuzzyRewrite(String fuzzyRewrite)
|
QueryStringQueryBuilder |
lenient(Boolean 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. |
QueryStringQueryBuilder |
lowercaseExpandedTerms(boolean lowercaseExpandedTerms)
Whether terms of wildcard, prefix, fuzzy and range queries are to be automatically lower-cased or not. |
QueryStringQueryBuilder |
minimumShouldMatch(String minimumShouldMatch)
|
QueryStringQueryBuilder |
phraseSlop(int phraseSlop)
Sets the default slop for phrases. |
QueryStringQueryBuilder |
quoteAnalyzer(String analyzer)
The optional analyzer used to analyze the query string for phrase searches. |
QueryStringQueryBuilder |
quoteFieldSuffix(String quoteFieldSuffix)
An optional field name suffix to automatically try and add to the field searched when using quoted text. |
QueryStringQueryBuilder |
rewrite(String rewrite)
|
QueryStringQueryBuilder |
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. |
QueryStringQueryBuilder |
useDisMax(boolean useDisMax)
When more than one field is used with the query string, should queries be combined using dis max, or boolean query. |
Methods inherited from class org.elasticsearch.index.query.BaseQueryBuilder |
---|
buildAsBytes, buildAsBytes, toString, toXContent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueryStringQueryBuilder(String queryString)
Method Detail |
---|
public QueryStringQueryBuilder defaultField(String defaultField)
public QueryStringQueryBuilder field(String field)
public QueryStringQueryBuilder field(String field, float boost)
public QueryStringQueryBuilder useDisMax(boolean useDisMax)
public QueryStringQueryBuilder tieBreaker(float tieBreaker)
public QueryStringQueryBuilder defaultOperator(QueryStringQueryBuilder.Operator defaultOperator)
In default mode (FieldQueryBuilder.Operator.OR
) terms without any modifiers
are considered optional: for example capital of Hungary
is equal to
capital OR of OR Hungary
.
In FieldQueryBuilder.Operator.AND
mode terms are considered to be in conjunction: the
above mentioned query is parsed as capital AND of AND Hungary
public QueryStringQueryBuilder analyzer(String analyzer)
public QueryStringQueryBuilder quoteAnalyzer(String analyzer)
public QueryStringQueryBuilder autoGeneratePhraseQueries(boolean autoGeneratePhraseQueries)
public QueryStringQueryBuilder allowLeadingWildcard(boolean allowLeadingWildcard)
public QueryStringQueryBuilder lowercaseExpandedTerms(boolean lowercaseExpandedTerms)
public QueryStringQueryBuilder enablePositionIncrements(boolean enablePositionIncrements)
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.
public QueryStringQueryBuilder fuzzyMinSim(float fuzzyMinSim)
public QueryStringQueryBuilder fuzzyPrefixLength(int fuzzyPrefixLength)
public QueryStringQueryBuilder fuzzyMaxExpansions(int fuzzyMaxExpansions)
public QueryStringQueryBuilder fuzzyRewrite(String fuzzyRewrite)
public QueryStringQueryBuilder phraseSlop(int phraseSlop)
public QueryStringQueryBuilder analyzeWildcard(boolean analyzeWildcard)
public QueryStringQueryBuilder rewrite(String rewrite)
public QueryStringQueryBuilder minimumShouldMatch(String minimumShouldMatch)
public QueryStringQueryBuilder boost(float boost)
boost
in interface BoostableQueryBuilder<QueryStringQueryBuilder>
public QueryStringQueryBuilder quoteFieldSuffix(String quoteFieldSuffix)
public QueryStringQueryBuilder lenient(Boolean lenient)
protected void doXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
doXContent
in class BaseQueryBuilder
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |