elasticsearch/docs/reference/query-languages/esql/functions-operators/search-functions.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.6 KiB
Markdown
Raw Normal View History

---
navigation_title: "Search functions"
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-functions-operators.html#esql-search-functions
---
# {{esql}} Search functions [esql-search-functions]
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
Use these functions
for [full-text search](docs-content://solutions/search/full-text.md)
and [semantic search](docs-content://solutions/search/semantic-search/semantic-search-semantic-text.md).
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
Get started with {{esql}} for search use cases with
our [hands-on tutorial](docs-content://solutions/search/esql-search-tutorial.md).
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
Full text functions can be used to
match [multivalued fields](/reference/query-languages/esql/esql-multivalued-fields.md).
A multivalued field that contains a value that matches a full text query is
considered to match the query.
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
Full text functions are significantly more performant for text search use cases
on large data sets than using pattern matching or regular expressions with
`LIKE` or `RLIKE`
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
See [full text search limitations](/reference/query-languages/esql/limitations.md#esql-limitations-full-text-search)
for information on the limitations of full text search.
{{esql}} supports these full-text search functions:
:::{include} ../_snippets/lists/search-functions.md
:::
:::{include} ../_snippets/functions/layout/kql.md
:::
:::{include} ../_snippets/functions/layout/match.md
:::
:::{include} ../_snippets/functions/layout/match_phrase.md
:::
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
:::{include} ../_snippets/functions/layout/qstr.md
:::
% TERM is currently a hidden feature
[ES|QL] Add MATCH_PHRASE (#127661) * Initial commit of match_phrase * Add MatchPhraseQueryTests * First pass at CSV specs * Update docs/changelog/127661.yaml * Refactor so MatchPhrase doesn't use all fulltext test cases, just text only * Fix tests * Add some CSV test cases * Fix test * Update changelog * Update tests * Comment out MATCH_PHRASE in search-functions Markdown * Minor PR feedback * PR feedback - refactor/consolidate code * Add some more tests * Fix some tests * [CI] Auto commit changes from spotless * Fix tests * PR feedback - add tests, support boost and numeric data * Revert "PR feedback - add tests, support boost and numeric data" This reverts commit 4e7a699e3e4cf3b13d4085151083ef0ff42c3d2d. * Apply testing/PR feedback outside numeric support only * Regenerate docs * Add negative test * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * Update x-pack/plugin/esql/qa/testFixtures/src/main/resources/match-phrase-function.csv-spec Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> * PR feedback * Fix auto-commit error * Regenerate docs * Update x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/MatchPhrase.java Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> * Remove non text field types * Fake test data * Remove tests that no longer should pass without ip/date/version support * Put real data in score tests now that I was able to engineer a failure * Realized the scoring test might be flakey because how it was written, updated * PR feedback * PR feedback * [CI] Auto commit changes from spotless * Add check to MatchPhrase tests * Fix merge errors * [CI] Auto commit changes from spotless * Test generated docs * Add additional verifier tests --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com> Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-06-05 00:32:24 +08:00
% To make it visible again, uncomment this and the line in
lists/search-functions.md
% :::{include} ../_snippets/functions/layout/term.md
% :::