Full text queries¶
Full text queries allow you to find results based on analyzed text fields.1 For example, by a word or phrase within a longer description.
Unlike term-level queries, the search terms you use in a full-text query are analyzed. This means what you search for is tokenized first (broken up into separate words), singular / plural variants determined, synonyms applied, and so on.
Details
Below are the various kinds of full text queries. These are sorted with the most commonly used at the top, and cover their usual usage. Each one is linked to Elasticsearch's own documentation to provide greater details. (In most cases there are many more options for each kind of query than what is documented here.)
Match¶
Match queries return results where the asset's value for that attribute matches some part of what you're searching.
| Build the query and request | |
|---|---|
1 2 3 | |
- You can search across all assets using the
select()method of theassetsmember on any client. -
Chain a
where()onto the select, with the static constant representing a field of the type you want to search to start a query, in this case theNAMEof anAsset. Adding thematch()predicate creates a match query.Equivalent query through ElasticQuery byMatch = MatchQuery.of(m -> m .field("name") .query("tmp") ._toQuery();
| Build the query | |
|---|---|
1 2 3 4 5 6 | |
- You can search across all assets using a
FluentSearch()object. - Use the class variable representing a field of the type you want to search to start a query, in this case the
NAMEof anAsset. Adding thematch()predicate creates a match query.
| Build the query and request | |
|---|---|
1 2 3 | |
- You can search across all assets using the
select()method of theassetsmember on any client. -
Chain a
where()onto the select, with the static constant representing a field of the type you want to search to start a query, in this case theNAMEof anAsset. Adding thematch()predicate creates a match query.Equivalent query through Elasticval byMatch = MatchQuery.of(m -> m .field("name") .query("tmp") ._toQuery()
| POST /api/meta/search/indexsearch | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
- Queries must be within the
dslobject in the API... - ...and within that the
queryobject. - For a match query, there needs to be a
matchobject embedded within thequeryobject. - Within this object should be a key with the name of the Elasticsearch field (Atlan attribute) to match against.
- The value for this field (attribute) to match against should be given through the
queryproperty.
Match phrase¶
Unlike a regular match query, which performs a full-text search and may return results with individual words appearing in any order, a match_phrase query ensures that the terms appear in the exact order specified.
For example, to search for assets where the description field contains the exact phrase "data pipeline":
Coming soon
| Build the query | |
|---|---|
1 2 3 4 5 6 7 | |
- You can search across all assets using a
FluentSearch()object. - Use the class variable representing a field of the type you want to search to start a query, in this case the
DESCRIPTIONof anAsset. Adding thematch_phrase()predicate creates a match phrase query.
Coming soon
| POST /api/meta/search/indexsearch | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
- Queries must be within the
dslobject in the API... - ...and within that the
queryobject. - For a match phrase query, there needs to be a
match_phraseobject embedded within thequeryobject. - Within this object should be a key with the name of the Elasticsearch field (Atlan attribute) to match against.
- The value for this field (attribute) to match against should be given through the
queryproperty.
-
This page is a summary of the details in the Elasticsearch Guide's Full text queries ↩