Information valid from AMI version 8.0sp2
Summary
AMI uses Elasticsearch 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
.
The <
and >
characters cannot be escaped.
Do not include them in a search term.
Syntax
This table lists the Elasticsearch Query String Syntax supported in AMI. See Elasticsearch's own Query String Syntax document for more information.
Syntax | Description | Example |
---|---|---|
OR | By default multi-term searches are OR'd together. Example: find matches that contain the word |
|
AND | Use the AND /&& keyword if both terms are required (in any order or position). |
|
NOT | Use the NOT /! /- keywords for words that must not be present. | canadian AND bacon NOT film |
Preferred | Use the Example: the word | canadian +bacon |
Grouping | Multiple terms or clauses can be grouped together with parentheses, to form sub-queries. | canadian AND (bacon OR ham) |
Wildcards | Wildcard searches can be run on individual terms, using Using the * wildcard at the beginning or end of a search term can use a lot of resources. | qu?ck bro* |
Regular Expressions | Regular expression patterns can be embedded in the query string by wrapping them in forward-slashes There is a performance overhead when using Regular Expressions. | /joh?n(ath[oa]n)/ |
Fuzziness | You can search for terms that are similar to, but not exactly like the search term using the “fuzzy” operator (~). The default edit distance is 2 but you can add an integer after the ~ to specify a different value. 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~ brwn~ foks~ |
Boosting | You can use the boost operator (^) to make one term more relevant than another. The default boost value for terms is 1: the positive number after the boost operator sets the relative relevance of the preceding term or grouping. | quick^2 brown fox^0.5 |