OJAI supports comparison, existence, between, match, like, type of, size of, in, and logical operators.
Click the name in the following box to navigate to the section that provides details on each operator.
| Operator | Syntax |
|---|---|
| Equals |
|
| Greater Than |
|
| Greater Than or Equals |
|
| Less Than |
|
| Less Than or Equals |
|
| Not Equals |
|
Compares the data in fieldpath against
value for the specified operator.
Float and double data are approximate representations of decimal values. They may not return true in equality comparisons against their equivalent decimal values.
You can specify only equality and non-equality conditions on nested documents and arrays.
In the case of equality on nested documents, all of the fields in the nested document must match. The order of the fields is not relevant.
In the case of equality on arrays, both the order of the elements and the element values must match.
{"$exists":"fieldpath"}
Checks for existence of fieldpath.
{"$notexists":"fieldpath"}
Checks for non-existence of fieldpath.
See Existence Conditions with Container Field Paths for details about how these operators behave when you use them with container field paths.
{"$between":{"fieldpath":[startValue,endValue]}}
Checks if the value in fieldpath is in the range specified by
startValue and endValue, where the
values are inclusive.
| Operator | Syntax |
|---|---|
| Matches |
|
| Not Matches |
|
Performs a regular expression match on fieldPath using
matchValue.
You can use regular expressions that compose the Perl-Compatible Regular Expressions (PCRE)
library as well as a subset of the regular expressions that are supported in
java.util.regex.pattern. See HBase Java Regular
Expressions Support for a list of supported regular expressions.
| Operator | Syntax |
|---|---|
| Like |
|
| Not Like |
|
Performs a SQL LIKE comparison on fieldPath
wherelikeValue is a string with wildcard characters '%'
and '_'.
$like operator expressions:
| Special-Purpose Character | Description | Example |
|---|---|---|
% |
Matches any string of zero or more characters. | "abc%" matches "abc",
"abcd", "abcde232136",
etc.
|
_ |
Matches a single character. | "_am" matches "ram",
"sam", "Sam",
"cam". |
[] |
Matches a single character in the specified set or range. | "[r-t]am" matches "ram",
"sam", and "tam" but not
"Sam" or "cam". |
[^] |
Matches a single character not in the specified set or range. | "[^r-t]am" matches "Sam",
"pam", "jam", or "cam"
but not "ram", "sam" and
"tam". |
{"$typeof":{"fieldpath":"typeValue"}}
Checks whether fieldpath is of type
typeValue.
{"$nottypeof":{"fieldpath":"typeValue"}}
Checks whether fieldpath is not of type
typeValue.
typeValue can be any of map,
array, binary, date,
time, timestamp, interval,
double, float, long,
int, short, byte,
string, boolean, or
null.
{"$sizeof":{"fieldpath":{"comparisonOp":intValue}}}
Compares the size of the data in fieldpath against
intValue, using comparisonOp . The
size varies depending on the type of fieldPath:
comparisonOp can be any of $eq,
$lt, $le, $gt,
$ge, or $ne.
{"$in":{"fieldpath":inOpValues}}
Checks whether the data in fieldpath is in the list
specified by inOpValues.
{"$notin":{"fieldpath":inOpValues}}
Checks whether the data in fieldpath is not in the list
specified by inOpValues
{"$and":[OJAIQueryConditions]}
Applies logical AND on a list of conditions.
OJAIQueryConditions is a comma-separated list of OJAI
query conditions.
{"$or":[OJAIQueryConditions]}
Applies logical OR on a list of conditions.
OJAIQueryConditions is a comma-separated list of OJAI
query conditions.
{
"$elementAnd":{
"containerFieldPath":
[OJAIQueryConditions]
}
}
Applies multiple conditions as part of a group. All conditions must be true for a common array element.
OJAIQueryConditions is the comma-separated list of the
OJAI query conditions.
containerFieldPath exhibits the following
behaviors:
containerFieldPath specifies the container path
prefix of the common container element.containerFieldPath refers to a container of
nested documents, then you must use field paths relative to the common prefix
in your OJAIQueryConditions .containerFieldPath refers to a container of
scalar values, then you use the $ symbol to refer to
individual elements in your OJAIQueryConditions. elementOr operator because it is semantically
equivalent to an OR operator.