/
Query String syntax

Query String syntax

Information valid from AMI version 8.0sp2

Summary

AMI uses Elasticsearch Simple Query String queries to perform free-text search. This lets you control aspects of a search using a basic Query String Syntax.

Free-text searches are used in the Search filter and for facets indexed as Text.




Terms

Search terms are searched for word by word. For example, if you entered the search terms onion rings then AMI would show results that had values that included either rings or onion: values of gold rings and red onions would both be valid matches, not just onion rings.

You can search for complete phrases by enclosing terms in double quote " characters. Entering "onion rings" would not match values of either gold rings or red onions.

When attributes are indexed for searching, any embedded references to other attributes, glossary terms or other Agility content is fully resolved. That means you cannot use free-text searching to look for reference tags.

Reserved characters

Some characters have a special meaning in Elasticsearch queries. These reserved characters should be escaped with a leading backslash character \

The reserved characters are: 
+ - | ( ) " ~ * \ /

For example, to filter a facet for a value containing 1/2 you should set the term to 1\/2

Syntax

This table lists the Elasticsearch Simple Query String Syntax supported in AMI. See Elasticsearch's own Simple Query String Syntax document (www.elastic.co) for more information.

Syntax

Description

Example

|

By default multi-term searches are OR'd together.

Example: find matches that contain the word canadian OR the word bacon (in any order or position).

canadian bacon

canadian | bacon

+

Use + if both terms are required (in any order or position).

canadian + bacon

-

Use - for words that must not be present.

Note that the example shows a search intended to find a value with both canadian and bacon and without film. If the + before -film was not there, because searches use OR by default, the search would actually match values that had either both canadian and bacon or didn't have film.

canadian + bacon + -film
~N
after a word

You can search for terms that are similar to, but not exactly like the search term using the “fuzzy” operator (~). 

The edit distance is the number of insertions, deletions, substitutions or transpositions required to change one word into another. See Damerau–Levenshtein distance (Wikipedia) for more information.

quikc~1 brwn~1 foks~1
~N
after a phrase

You can set a slop amount for a phrase to indicate the number of words within it that may be different and still match.

The example would match  value of quick brown fox as only one word is different in the phrase. It would not match brown quick fox.

"quick red fox"~1
( )Use parentheses ( and ) to signify logical precedence.quick + (brown | red) + fox
*Use * to signify a prefix query.qu*