copyright | lastupdated | subcollection | ||
---|---|---|---|---|
|
2020-05-13 |
discovery-data |
{:shortdesc: .shortdesc} {:external: target="_blank" .external} {:tip: .tip} {:note: .note} {:pre: .pre} {:important: .important} {:deprecated: .deprecated} {:codeblock: .codeblock} {:screen: .screen} {:download: .download} {:hide-dashboard: .hide-dashboard} {:apikey: data-credential-placeholder='apikey'} {:url: data-credential-placeholder='url'} {:curl: .ph data-hd-programlang='curl'} {:javascript: .ph data-hd-programlang='javascript'} {:java: .ph data-hd-programlang='java'} {:python: .ph data-hd-programlang='python'} {:ruby: .ph data-hd-programlang='ruby'} {:swift: .ph data-hd-programlang='swift'} {:go: .ph data-hd-programlang='go'}
{: #query-operators}
These operators are used when writing queries with the {{site.data.keyword.discoveryshort}} Query Language. For more information, see the {{site.data.keyword.discoveryshort}} API reference{: external}. For an overview of query concepts, see the Query overview. {: shortdesc}
Operators are the separators between different parts of a query. For the complete list of available operators, see the Query reference. {: tip}
{: #delimiter}
This delimiter separates the levels of hierarchy in the JSON schema
For example:
enriched_text.concepts.text
{: codeblock}
{: #includes}
This operator specifies a match for the query term.
For example:
enriched_text.concepts.text:"cloud computing"
{: codeblock}
{: #match}
This operator specifies an exact match for the query term.
For example:
enriched_text.concepts.text::"Cloud computing"
{: codeblock}
Exact matches are case-sensitive.
{: #notinclude}
This operator specifies that the results do not contain a match for the query term
For example:
enriched_text.concepts.text:!"cloud computing"
{: codeblock}
{: #notamatch}
This operator specifies that the results do not exactly match the query term
For example:
enriched_text.concepts.text::!"Cloud computing"
{: codeblock}
Exact matches are case-sensitive.
{: #escape}
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\""
{: codeblock}
{: #phrase}
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.
{: note}
For example:
enriched_text.entities.text:"IBM watson"
{: codeblock}
{: #nestedquery}
Logical groupings can be formed to specify more specific information.
For example:
enriched_text.entities:(text:IBM,type:Company)
{: codeblock}
{: #or}
Boolean operator for "or".
For example:
enriched_text.entities.text:Google|IBM
{: codeblock}
{: #and}
Boolean operator for "and".
For example:
enriched_text.entities.text:Google,IBM
{: codeblock}
{: #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
{: codeblock}
{: #multiplier}
Increases the score value of a search term.
For example:
enriched_text.concepts.text:IBM^3
{: codeblock}
{: #wildcard}
Matches unknown characters in a search expression. Do not use capital letters with wildcards.
For example:
enriched_text.entities.text:ib*
{: codeblock}
{: #variation}
The number of one character changes that need to be made to one string to make it the same as another string. For example car~1
will match car
,cap
,cat
,can
, etc.
For example:
enriched_text.concepts.text:Watson~3
{: codeblock}
{: #exists}
Used to return all results where the specified field
exists.
For example:
title:*
{: codeblock}
{: #dnexist}
Used to return all results that do not include the specified field
.
For example:
title:!*
{: codeblock}