Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPL manual update #236

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,22 @@ parameters:
|------------|
| Bond |
+------------+

### Limitations

The relevance functions are available to execute only in OpenSearch DSL
but not in memory as of now, so the relevance search might fail for
queries that are too complex to translate into DSL if the relevance
function is following after a complex PPL query. To make your queries
always work-able, it is recommended to place the relevance commands as
close to the search command as possible, to ensure the relevance
functions are eligible to push down. For example, a complex query like
\`search source = people | rename firstname as name | dedup account_number | fields name, account_number, balance, employer | where match(employer, 'Open Search') | stats count() by city\`
could fail because it is difficult to translate to DSL, but it would be
better if we rewrite it to an equivalent query as
\`search source = people | where match(employer, 'Open Search') | rename firstname as name | dedup account_number | fields name, account_number, balance, employer | stats count() by city\`
by moving the where command with relevance function to the second
command right after the search command, and the relevance would be
optimized and executed smoothly in OpenSearch DSL. See [Optimization](https://github.com/opensearch-project/sql/blob/22924b13d9cb46759c8d213a7ce903effe06ab47/docs/user/optimization/optimization.rst)
to get more details about the query engine optimization.
`;