IBM Cloud Docs
Query operators

Query operators

Operators are the separators between different parts of a query. For the complete list of available operators, see the Query reference.

. [JSON delimiter]

This delimiter separates the levels of hierarchy in the JSON schema

For example:

enriched_text.concepts.text

: [Includes]

This operator specifies a match for the query term.

For example:

enriched_text.concepts.text:"cloud computing"

:: [Exact match]

This operator specifies an exact match for the query term.

For example:

enriched_text.concepts.text::"Cloud computing"

Exact matches are case-sensitive.

:! [Does not include]

This operator specifies that the results do not contain a match for the query term

For example:

enriched_text.concepts.text:!"cloud computing"

::! [Not an exact match]

This operator specifies that the results do not exactly match the query term

For example:

enriched_text.concepts.text::!"Cloud computing"

Exact matches are case-sensitive.

\ [Escape character]

Escape character for queries that require the ability to query terms by using string literals that contain control characters.

For example:

title::"Dorothy said: \"There's no place like home\""

"" [Phrase query]

All contents of a phrase query are processed as escaped. So no special characters within a phrase query are parsed, except for double quotes (") inside a phrase query, which must be escaped (\"). Use phrase queries with full-text, rank-based queries, and not with boolean filter operations. Do not use wildcards (*) in phrase queries.

Single quotes (') are not supported.

For example:

enriched_text.entities.text:"IBM watson"

(), [] [Nested grouping]

Logical groupings can be formed to specify more specific information.

For example:

enriched_text.entities:(text:IBM,type:Company)

| [or]

Boolean operator for "or".

In the following example, documents in which Google or IBM are identified as entities are returned:

enriched_text.entities.text:Google|enriched_text.entities.text:IBM

The includes (:,:!) and match (::, ::!) operators have precedence over the OR operator.

For example, the following syntax searches for documents in which Google is identified as an entity or the string IBM is present:

enriched_text.entities.text:Google|IBM

The query is treated as follows:

(enriched_text.entities.text:Google) OR IBM

, [and]

Boolean operator for "and".

In the following example, documents in which Google and IBM both are identified as entities are returned:

enriched_text.entities.text:Google,enriched_text.entities.text:IBM

The includes (:,:!) and match (::, ::!) operators have precedence over the AND operator.

For example, the following syntax searches for documents in which Google is identified as an entity and the string IBM is present:

enriched_text.entities.text:Google,IBM

The query is treated as follows:

(enriched_text.entities.text:Google) AND IBM

<=, >=, >, < [Numerical comparisons]

Creates numerical comparisons of less than or equal to, greater than or equal to, greater than, and less than.

For example:

enriched_text.sentiment.document.score>0.679

^x [Score multiplier]

Increases the score value of a search term.

For example:

enriched_text.concepts.text:IBM^3

* [Wildcard]

Matches unknown characters in a search expression. Do not use capital letters with wildcards.

For example:

enriched_text.entities.text:ib*

~n [String variation]

The number of one-character changes to make one string match another. For example, car~1 matches car,cap,cat,can, and so on.

For example:

enriched_text.concepts.text:Watson~3

:* [Exists]

Used to return all results where the specified field exists.

For example:

title:*

!* [Does not exist]

Used to return all results that do not include the specified field.

For example:

title:!*