FIND
Use FIND to search documents and Vault objects.
When using FIND on documents, Vault searches all queryable document fields. You can configure object references to search additional object fields by configuring Searchable Object Fields. Learn more in Vault Help
FINDfor documents is available in Vault API v8.0+FINDfor standard volume Vault objects is available in Vault API v14.0+FINDis not supported on raw Vault objects or in attachment subqueriesFINDis supported inSELECTstatements. In 25.3+, you can also useFINDin all subqueries except attachment subequeries.
You can scope your search to specific fields, document content, or both. When using FIND without SCOPE, VQL uses SCOPE PROPERTIES by default.
VQL automatically adds wildcards to most search terms. Learn more about wildcarding, search tokenization, stemming, order of evaluation, and other topics in Searching & Filtering.
Syntax
Section link for SyntaxSELECT {fields}
FROM {query target}
FIND ('{search phrase}')The FIND search phrase must be enclosed in single quotation marks. The entire FIND statement (search phrase and scopes) must be enclosed in parentheses.
The maximum search term length is 250 characters. The minimum search term length is 1 character.
The search phrase is not case sensitive.
Functions & Options
Section link for Functions & OptionsYou can use the following functions and query target options in the FIND clause. For full technical details, see the VQL Functions & Options reference.
Refining Search Scope
Section link for Refining Search ScopeThese options control which fields or content are searched.
| Name | Goal | API Version |
|---|---|---|
SCOPE ALL | Search all fields and document content. | v8.0+ |
SCOPE CONTENT | Search document content only. | v8.0+ |
SCOPE {fields} | Search one specific document field or up to 25 object fields. | v15.0+ |
SCOPE PROPERTIES | Search all picklists and text-based fields (default scope). | v8.0+ |
Advanced Matching
Section link for Advanced MatchingThese functions and options provide more granular control over search results.
| Name | Goal | API Version |
|---|---|---|
DISTANCE | Enable fuzzy search with an edit distance of up to 2. | v26.1+ |
FILENAME() | Search by Attachment file name instead of file handle. | v24.3+ |
Operators
Section link for OperatorsYou can use the following logical operators in the FIND clause:
| Name | Syntax | Description |
|---|---|---|
AND | FIND ('{v1} AND {v2}') | All terms in the search string must match. |
NOT | FIND (NOT '{phrase}') | Results must not match the specified search string. |
OR | FIND ('{v1} OR {v2}') | At least one term in the search string must match. |
Query Examples
Section link for Query ExamplesThe following are examples of queries using FIND.
Query: Find Documents with a Search Term Match
Section link for Query: Find Documents with a Search Term MatchThe following query returns the latest version of all documents that contain the search term insulin (case insensitive):
SELECT id, name__v
FROM documents
FIND ('insulin')Response
Section link for Response{
"responseStatus": "SUCCESS",
"responseDetails": {
"find": "('insulin')",
"pagesize": 1000,
"pageoffset": 0,
"size": 3,
"total": 3
},
"data": [
{
"id": 200,
"name__v": "Test Doc Nyaxa Insulin"
},
{
"id": 198,
"name__v": "Test Doc Diabetes Insulin"
},
{
"id": 197,
"name__v": "Test Doc Nyaxa Diabetes Insulin"
}
]
}Query: Find Objects with a Search Term Match
Section link for Query: Find Objects with a Search Term MatchThe following query returns the ID, compound ID, and abbreviation of all Product records that contain the search term cc in one or more fields (case insensitive):
SELECT id, compound_id__c, abbreviation__c
FROM product__v
FIND ('cc')Response
Section link for Response{
"responseStatus": "SUCCESS",
"responseDetails": {
"find": "('cc')",
"pagesize": 1000,
"pageoffset": 0,
"size": 2,
"total": 2
},
"data": [
{
"id": "00P000000000302",
"compound_id__c": "CC-123",
"abbreviation__c": "CC"
},
{
"id": "00P000000000301",
"compound_id__c": "CC-127",
"abbreviation__c": null
}
]
}Query: Find Documents with Any Search Term
Section link for Query: Find Documents with Any Search TermTo search document fields containing any of the provided search terms, use the OR operator between them.
SELECT id, name__v
FROM documents
FIND ('insulin OR diabetes')Query: Find Documents with All Search Terms
Section link for Query: Find Documents with All Search TermsTo search document fields containing all search terms, use the AND operator between each search term.
SELECT id, name__v
FROM documents
FIND ('insulin AND diabetes AND Nyaxa')Query: Find Documents with an Exact Search Term Match
Section link for Query: Find Documents with an Exact Search Term MatchTo search for an exact match, enclose the string in double quotes within the single quotes.
SELECT id, name__v
FROM documents
FIND ('"blood sugar"')Query: Find Documents Using Strict Matching
Section link for Query: Find Documents Using Strict MatchingA FIND search phrase without operators uses strict matching.
SELECT id, name__v
FROM documents
FIND ('insulin diabetes gludacta')Query: Find Documents with a Partial Search Term Match
Section link for Query: Find Documents with a Partial Search Term MatchThe following query uses the wildcard character (*) to retrieve partial matches.
SELECT id, name__v
FROM documents
FIND ('ins* dia* glu*')Query: Find Documents Without a Search Term Match
Section link for Query: Find Documents Without a Search Term MatchUse NOT with FIND to exclude results from a query.
SELECT id, name__v
FROM documents
FIND (NOT 'insulin')Query: Search Only Document Content
Section link for Query: Search Only Document ContentThe following example uses the SCOPE CONTENT option.
SELECT id, name__v
FROM documents
FIND ('insulin' SCOPE CONTENT)Query: Filter Search Results with WHERE
Section link for Query: Filter Search Results with WHEREWHERE must be placed after the FIND clause.
SELECT id, name__v
FROM product__v
FIND ('phosphate' SCOPE generic_name__vs)
WHERE therapeutic_area__vs = 'cardiology__vs'Query: FIND with Inner Join Subqueries
Section link for Query: FIND with Inner Join SubqueriesSELECT id, name__v
FROM product__v
WHERE id IN (SELECT id FROM dosages__vr FIND ('standard' SCOPE name__v))Query: FIND with Outer Join Subquery
Section link for Query: FIND with Outer Join SubquerySELECT id,
(SELECT id, name__v FROM dosages__vr FIND ('standard' SCOPE name__v))
FROM product__v