public final class ElasticsearchQueryHelper extends Object
| Modifier and Type | Method and Description | 
|---|---|
static void | boolAddFilter(JsonObject bool, JsonObject filter)Add a filter to a bool query.  | 
static void | boolAddMust(JsonObject bool, JsonObject must)Add a "must" clause to a bool query.  | 
static void | boolAddMustNot(JsonObject bool, JsonObject mustNot)Add a "must_not" clause to a bool query.  | 
static void | boolAddShould(JsonObject bool, JsonObject should)Add a "should" clause to a bool query.  | 
static JsonObject | boolQuery()Create a query that allows for boolean combinations of other queries  | 
static JsonObject | boolQuery(int minimumShouldMatch)Create a query that allows for boolean combinations of other queries  | 
static JsonObject | existsQuery(String name)Create a query that looks if a field with the given name exists  | 
static JsonObject | geoShapeQuery(String name, JsonObject shape, String relation)Create a query that looks for documents matching a geo shape  | 
static JsonObject | gteQuery(String name, Object value)Create a term query to compare a field to a value using greater than or equal to as operator.  | 
static JsonObject | gtQuery(String name, Object value)Create a term query to compare a field to a value using greater than as operator.  | 
static JsonObject | lteQuery(String name, Object value)Create a term query to compare a field to a value using less than or equal to as operator.  | 
static JsonObject | ltQuery(String name, Object value)Create a term query to compare a field to a value using less than as operator.  | 
static JsonObject | matchAllQuery()Create a query that matches all documents  | 
static JsonObject | multiMatchQuery(Object text, String... fieldNames)Create a query that compares a value to multiple fields  | 
static JsonObject | prefixQuery(String name, Object prefix)Create a query that looks for a field starting with a given prefix  | 
static JsonObject | shape(String type, JsonArray coordinates)Create a geo shape  | 
static JsonObject | termQuery(String name, Object value)Create a term query to exactly compare a field to a value  | 
public static JsonObject boolQuery()
public static JsonObject boolQuery(int minimumShouldMatch)
minimumShouldMatch - the minimum number of should clauses to matchpublic static void boolAddFilter(JsonObject bool, JsonObject filter)
bool - the bool queryfilter - the filter to addpublic static void boolAddMust(JsonObject bool, JsonObject must)
bool - the bool querymust - the clause to addpublic static void boolAddMustNot(JsonObject bool, JsonObject mustNot)
bool - the bool querymustNot - the clause to addpublic static void boolAddShould(JsonObject bool, JsonObject should)
bool - the bool queryshould - the clause to addpublic static JsonObject termQuery(String name, Object value)
name - the field's namevalue - the value to compare topublic static JsonObject ltQuery(String name, Object value)
name - the field's namevalue - the value to compare topublic static JsonObject lteQuery(String name, Object value)
name - the field's namevalue - the value to compare topublic static JsonObject gtQuery(String name, Object value)
name - the field's namevalue - the value to compare topublic static JsonObject gteQuery(String name, Object value)
name - the field's namevalue - the value to compare topublic static JsonObject matchAllQuery()
public static JsonObject multiMatchQuery(Object text, String... fieldNames)
text - the valuefieldNames - the names of the fields to compare topublic static JsonObject existsQuery(String name)
name - the field's namepublic static JsonObject prefixQuery(String name, Object prefix)
name - the field's nameprefix - the prefixpublic static JsonObject geoShapeQuery(String name, JsonObject shape, String relation)
name - the field name containing the document's geo shapeshape - the geo shape to compare torelation - the relation used for comparison (i.e. "intersects", "disjoint", "within", "contains")public static JsonObject shape(String type, JsonArray coordinates)
type - the shape's type (e.g. "envelope")coordinates - the shape's coordinates