org.elasticsearch.index.query.xcontent
Class TextQueryBuilder

java.lang.Object
  extended by org.elasticsearch.index.query.xcontent.BaseQueryBuilder
      extended by org.elasticsearch.index.query.xcontent.TextQueryBuilder
All Implemented Interfaces:
ToXContent, QueryBuilder, XContentQueryBuilder

public class TextQueryBuilder
extends BaseQueryBuilder

Text query is a query that analyzes the text and constructs a query as the result of the analysis. It can construct different queries based on the type provided.


Nested Class Summary
static class TextQueryBuilder.Operator
           
static class TextQueryBuilder.Type
           
 
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
TextQueryBuilder(java.lang.String name, java.lang.Object text)
          Constructs a new text query.
 
Method Summary
 TextQueryBuilder analyzer(java.lang.String analyzer)
          Explicitly set the analyzer to use.
 TextQueryBuilder boost(float boost)
          Set the boost to apply to the query.
 void doXContent(XContentBuilder builder, ToXContent.Params params)
           
 TextQueryBuilder fuzziness(java.lang.Object fuzziness)
          Sets the minimum similarity used when evaluated to a fuzzy query type.
 TextQueryBuilder maxExpansions(int maxExpansions)
          When using fuzzy or prefix type query, the number of term expansions to use.
 TextQueryBuilder operator(TextQueryBuilder.Operator operator)
          Sets the operator to use when using a boolean query.
 TextQueryBuilder slop(int slop)
          Set the phrase slop if evaluated to a phrase query type.
 TextQueryBuilder type(TextQueryBuilder.Type type)
          Sets the type of the text query.
 
Methods inherited from class org.elasticsearch.index.query.xcontent.BaseQueryBuilder
buildAsBytes, buildAsBytes, buildAsUnsafeBytes, buildAsUnsafeBytes, toXContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextQueryBuilder

public TextQueryBuilder(java.lang.String name,
                        java.lang.Object text)
Constructs a new text query.

Method Detail

type

public TextQueryBuilder type(TextQueryBuilder.Type type)
Sets the type of the text query.


operator

public TextQueryBuilder operator(TextQueryBuilder.Operator operator)
Sets the operator to use when using a boolean query. Defaults to OR.


analyzer

public TextQueryBuilder analyzer(java.lang.String analyzer)
Explicitly set the analyzer to use. Defaults to use explicit mapping config for the field, or, if not set, the default search analyzer.


boost

public TextQueryBuilder boost(float boost)
Set the boost to apply to the query.


slop

public TextQueryBuilder slop(int slop)
Set the phrase slop if evaluated to a phrase query type.


fuzziness

public TextQueryBuilder fuzziness(java.lang.Object fuzziness)
Sets the minimum similarity used when evaluated to a fuzzy query type. Defaults to "0.5".


maxExpansions

public TextQueryBuilder maxExpansions(int maxExpansions)
When using fuzzy or prefix type query, the number of term expansions to use. Defaults to unbounded so its recommended to set it to a reasonable value for faster execution.


doXContent

public void doXContent(XContentBuilder builder,
                       ToXContent.Params params)
                throws java.io.IOException
Specified by:
doXContent in class BaseQueryBuilder
Throws:
java.io.IOException