Skip to main content
Version: 24.3.x

Categories: String

CONTAINS

Returns documents matching the provided Lucene expression.

Syntax

CONTAINS(luceneExpression varchar) → dataset

  • luceneExpression: The Lucene expression to use as a search term.

Examples

CONTAINS example
SELECT column1 from ElasticSearchSource.index1."_doc" WHERE CONTAINS('dremio')
-- All documents that contain the word "dremio".
CONTAINS example
SELECT column1 from ElasticSearchSource.index1."_doc" WHERE CONTAINS(column1:dremio AND column2:lakehouse)
-- All documents that contain the word "dremio" in column1 and "lakehouse" in column2.

Usage Notes

This function can only be used with Elasticsearch sources. At its simplest, the Lucene expression can be a list of words, such as CONTAINS( dremio sql). If no field names are specified, Dremio searches across all the fields in the document. To specify field names, use CONTAINS(<col1>:<search_term> AND <col2>:<search_term>).