public class MultiMatchQueryBuilder extends AbstractQueryBuilder<MultiMatchQueryBuilder>
MatchQueryBuilder
but supports multiple fields.Modifier and Type | Class and Description |
---|---|
static class |
MultiMatchQueryBuilder.Type |
Writeable.Reader<V>, Writeable.Writer<V>
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_LENIENCY |
static int |
DEFAULT_MAX_EXPANSIONS |
static Operator |
DEFAULT_OPERATOR |
static int |
DEFAULT_PHRASE_SLOP |
static int |
DEFAULT_PREFIX_LENGTH |
static MultiMatchQueryBuilder.Type |
DEFAULT_TYPE |
static MatchQuery.ZeroTermsQuery |
DEFAULT_ZERO_TERMS_QUERY |
static java.lang.String |
NAME |
boost, BOOST_FIELD, DEFAULT_BOOST, NAME_FIELD, queryName
EMPTY_PARAMS
Constructor and Description |
---|
MultiMatchQueryBuilder(java.lang.Object value,
java.lang.String... fields)
Constructs a new text query.
|
MultiMatchQueryBuilder(StreamInput in)
Read from a stream.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
analyzer() |
MultiMatchQueryBuilder |
analyzer(java.lang.String analyzer)
Explicitly set the analyzer to use.
|
java.lang.Float |
cutoffFrequency() |
MultiMatchQueryBuilder |
cutoffFrequency(float cutoff)
Set a cutoff value in [0..1] (or absolute number >=1) representing the
maximum threshold of a terms document frequency to be considered a low
frequency term.
|
MultiMatchQueryBuilder |
cutoffFrequency(java.lang.Float cutoff)
Set a cutoff value in [0..1] (or absolute number >=1) representing the
maximum threshold of a terms document frequency to be considered a low
frequency term.
|
protected boolean |
doEquals(MultiMatchQueryBuilder other)
Indicates whether some other
QueryBuilder object of the same type is "equal to" this one. |
protected int |
doHashCode() |
protected org.apache.lucene.search.Query |
doToQuery(QueryShardContext context) |
protected void |
doWriteTo(StreamOutput out) |
void |
doXContent(XContentBuilder builder,
ToXContent.Params params) |
MultiMatchQueryBuilder |
field(java.lang.String field)
Adds a field to run the multi match against.
|
MultiMatchQueryBuilder |
field(java.lang.String field,
float boost)
Adds a field to run the multi match against with a specific boost.
|
java.util.Map<java.lang.String,java.lang.Float> |
fields() |
MultiMatchQueryBuilder |
fields(java.util.Map<java.lang.String,java.lang.Float> fields)
Add several fields to run the query against with a specific boost.
|
static java.util.Optional<MultiMatchQueryBuilder> |
fromXContent(QueryParseContext parseContext) |
Fuzziness |
fuzziness() |
MultiMatchQueryBuilder |
fuzziness(java.lang.Object fuzziness)
Sets the fuzziness used when evaluated to a fuzzy query type.
|
java.lang.String |
fuzzyRewrite() |
MultiMatchQueryBuilder |
fuzzyRewrite(java.lang.String fuzzyRewrite) |
MultiMatchQueryBuilder.Type |
getType()
Returns the type (for testing)
|
java.lang.String |
getWriteableName()
Returns the name of the writeable object
|
boolean |
lenient() |
MultiMatchQueryBuilder |
lenient(boolean lenient)
Sets whether format based failures will be ignored.
|
int |
maxExpansions() |
MultiMatchQueryBuilder |
maxExpansions(int maxExpansions)
When using fuzzy or prefix type query, the number of term expansions to use.
|
java.lang.String |
minimumShouldMatch() |
MultiMatchQueryBuilder |
minimumShouldMatch(java.lang.String minimumShouldMatch) |
Operator |
operator() |
MultiMatchQueryBuilder |
operator(Operator operator)
Sets the operator to use when using a boolean query.
|
int |
prefixLength() |
MultiMatchQueryBuilder |
prefixLength(int prefixLength) |
int |
slop() |
MultiMatchQueryBuilder |
slop(int slop)
Set the phrase slop if evaluated to a phrase query type.
|
java.lang.Float |
tieBreaker() |
MultiMatchQueryBuilder |
tieBreaker(float tieBreaker)
Tie-Breaker for "best-match" disjunction queries (OR-Queries).
|
MultiMatchQueryBuilder |
tieBreaker(java.lang.Float tieBreaker)
Tie-Breaker for "best-match" disjunction queries (OR-Queries).
|
MultiMatchQueryBuilder.Type |
type() |
MultiMatchQueryBuilder |
type(MultiMatchQueryBuilder.Type type)
Sets the type of the text query.
|
MultiMatchQueryBuilder |
type(java.lang.Object type)
Sets the type of the text query.
|
java.lang.Boolean |
useDisMax() |
MultiMatchQueryBuilder |
useDisMax(java.lang.Boolean useDisMax)
Deprecated.
use a tieBreaker of 1.0f to disable "dis-max"
query or select the appropriate
MultiMatchQueryBuilder.Type |
java.lang.Object |
value() |
MatchQuery.ZeroTermsQuery |
zeroTermsQuery() |
MultiMatchQueryBuilder |
zeroTermsQuery(MatchQuery.ZeroTermsQuery zeroTermsQuery) |
addValidationError, boost, boost, convertToBytesRefIfString, convertToStringIfBytesRef, declareStandardFields, doRewrite, equals, extractInnerHitBuilders, getName, hashCode, printBoostAndQueryName, queryName, queryName, readQueries, requireValue, rewrite, throwParsingExceptionOnMultipleFields, toFilter, toQueries, toQuery, toXContent, writeQueries, writeTo
buildAsBytes, buildAsBytes, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
rewriteQuery
public static final java.lang.String NAME
public static final MultiMatchQueryBuilder.Type DEFAULT_TYPE
public static final Operator DEFAULT_OPERATOR
public static final int DEFAULT_PHRASE_SLOP
public static final int DEFAULT_PREFIX_LENGTH
public static final int DEFAULT_MAX_EXPANSIONS
public static final boolean DEFAULT_LENIENCY
public static final MatchQuery.ZeroTermsQuery DEFAULT_ZERO_TERMS_QUERY
public MultiMatchQueryBuilder(java.lang.Object value, java.lang.String... fields)
public MultiMatchQueryBuilder(StreamInput in) throws java.io.IOException
java.io.IOException
public MultiMatchQueryBuilder.Type getType()
protected void doWriteTo(StreamOutput out) throws java.io.IOException
doWriteTo
in class AbstractQueryBuilder<MultiMatchQueryBuilder>
java.io.IOException
public java.lang.Object value()
public MultiMatchQueryBuilder field(java.lang.String field)
public MultiMatchQueryBuilder field(java.lang.String field, float boost)
public MultiMatchQueryBuilder fields(java.util.Map<java.lang.String,java.lang.Float> fields)
public java.util.Map<java.lang.String,java.lang.Float> fields()
public MultiMatchQueryBuilder type(MultiMatchQueryBuilder.Type type)
public MultiMatchQueryBuilder type(java.lang.Object type)
public MultiMatchQueryBuilder.Type type()
public MultiMatchQueryBuilder operator(Operator operator)
public Operator operator()
public MultiMatchQueryBuilder analyzer(java.lang.String analyzer)
public java.lang.String analyzer()
public MultiMatchQueryBuilder slop(int slop)
public int slop()
public MultiMatchQueryBuilder fuzziness(java.lang.Object fuzziness)
public Fuzziness fuzziness()
public MultiMatchQueryBuilder prefixLength(int prefixLength)
public int prefixLength()
public MultiMatchQueryBuilder maxExpansions(int maxExpansions)
public int maxExpansions()
public MultiMatchQueryBuilder minimumShouldMatch(java.lang.String minimumShouldMatch)
public java.lang.String minimumShouldMatch()
public MultiMatchQueryBuilder fuzzyRewrite(java.lang.String fuzzyRewrite)
public java.lang.String fuzzyRewrite()
@Deprecated public MultiMatchQueryBuilder useDisMax(java.lang.Boolean useDisMax)
MultiMatchQueryBuilder.Type
public java.lang.Boolean useDisMax()
public MultiMatchQueryBuilder tieBreaker(float tieBreaker)
Tie-Breaker for "best-match" disjunction queries (OR-Queries). The tie breaker capability allows documents that match more than one query clause (in this case on more than one field) to be scored better than documents that match only the best of the fields, without confusing this with the better case of two distinct matches in the multiple fields.
A tie-breaker value of 1.0 is interpreted as a signal to score queries as "most-match" queries where all matching query clauses are considered for scoring.
MultiMatchQueryBuilder.Type
public MultiMatchQueryBuilder tieBreaker(java.lang.Float tieBreaker)
Tie-Breaker for "best-match" disjunction queries (OR-Queries). The tie breaker capability allows documents that match more than one query clause (in this case on more than one field) to be scored better than documents that match only the best of the fields, without confusing this with the better case of two distinct matches in the multiple fields.
A tie-breaker value of 1.0 is interpreted as a signal to score queries as "most-match" queries where all matching query clauses are considered for scoring.
MultiMatchQueryBuilder.Type
public java.lang.Float tieBreaker()
public MultiMatchQueryBuilder lenient(boolean lenient)
public boolean lenient()
public MultiMatchQueryBuilder cutoffFrequency(float cutoff)
public MultiMatchQueryBuilder cutoffFrequency(java.lang.Float cutoff)
public java.lang.Float cutoffFrequency()
public MultiMatchQueryBuilder zeroTermsQuery(MatchQuery.ZeroTermsQuery zeroTermsQuery)
public MatchQuery.ZeroTermsQuery zeroTermsQuery()
public void doXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
doXContent
in class AbstractQueryBuilder<MultiMatchQueryBuilder>
java.io.IOException
public static java.util.Optional<MultiMatchQueryBuilder> fromXContent(QueryParseContext parseContext) throws java.io.IOException
java.io.IOException
public java.lang.String getWriteableName()
NamedWriteable
protected org.apache.lucene.search.Query doToQuery(QueryShardContext context) throws java.io.IOException
doToQuery
in class AbstractQueryBuilder<MultiMatchQueryBuilder>
java.io.IOException
protected int doHashCode()
doHashCode
in class AbstractQueryBuilder<MultiMatchQueryBuilder>
protected boolean doEquals(MultiMatchQueryBuilder other)
AbstractQueryBuilder
QueryBuilder
object of the same type is "equal to" this one.doEquals
in class AbstractQueryBuilder<MultiMatchQueryBuilder>