-
Notifications
You must be signed in to change notification settings - Fork 159
add query rules gui page and the menu option #2252
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
Changes from all commits
0c4b77b
0c02fb8
06fd408
be03bc3
0c3b66b
ab2dc03
a5a8915
b24aacc
7a16782
ca8cfb9
b7fa613
7bd9670
6f7e006
0f3081c
64649dc
ccc0917
5ebf6a3
227f6fd
601baff
79f0dd7
c8e2bf7
3d47890
c9c41f4
169d96e
6d2492f
a5bae84
ad4907b
243302f
fe7098b
81ec5f8
15cc98b
c0abcb7
fccfb0e
32edd89
d64ffa2
151789e
6ae8d76
0d579b6
ace847e
e541b6c
37e171b
aadc48c
3d54895
f085f5a
f2c1691
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
--- | ||
applies_to: | ||
stack: ga 9.1 | ||
serverless: ga | ||
elasticsearch: | ||
--- | ||
|
||
# Query rules UI | ||
Use query rules to boost, pin, or exclude specific documents when queries contain certain keywords, phrases, or match defined search patterns. | ||
The Query rules UI provides a graphical interface to manage these rules without writing API calls or JSON configuration. | ||
|
||
The UI enables you to: | ||
|
||
- Set keyword triggers and conditions for when rules apply | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keyword or numerical conditions such as less than or greater than 😉 |
||
- Pin, boost, or exclude specific documents in results | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, we should remove boost here. |
||
- Organize rules into rulesets and set execution priority | ||
- Test rules against sample queries before publishing | ||
|
||
## UI vs. API: What's the difference? | ||
|
||
ketkee-aryamane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The Query Rules UI provides the same functionality as the API with one key difference in how documents are pinned: | ||
|
||
* The UI defaults to `docs` for maximum flexibility, but still allows `id`-based pinning for single-index searches through a simplified form. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a little confusing wording to me - IIRC ids were not that well supported in the UI, you can't edit an id based rule for example. Also I don't think the UI allows you to create an empty docs rule, which would behave in the same way as an id rule. |
||
|
||
To see examples of how to search using query rules, refer [Search using Query Rules API](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules). | ||
|
||
If you prefer to use the Query Rules API, refer to [Query Rules API]({{es-apis}}group/endpoint-query_rules). | ||
|
||
## Requirements | ||
|
||
If you want to get full access to the Query Rules UI, you must have the following privileges: | ||
|
||
* Appropriate roles to access Kibana. For more information, refer to [Built-in roles](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/built-in-roles) or [Kibana privileges](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/kibana-privileges) | ||
* A custom role with `manage_search_query_rules` cluster privilege | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should think about removing |
||
* `ALL` option for `Query Rules` role privilege in the respective Kibana space | ||
|
||
## Accessing the Query Rules UI | ||
|
||
Go to your deployment and select **Query Rules** from the left navigation menu under **Relevance**. If you're not able to see the option, contact the administrator to review the role assigned to you. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would replace this with |
||
|
||
:::{image} /solutions/images/elasticsearch-query-rules-ui-home.png | ||
:alt: Landing page for Query Rules UI. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warning, screenshots in docs is dangerous, because it has to be updated if and when the UI inevitably changes 😁 |
||
:screenshot: | ||
::: | ||
|
||
### Create a query rule | ||
Use the following steps to first create a query ruleset, and then a query rule: | ||
|
||
1. Select **Query Rules** in the navigation menu under **Relevance**. | ||
2. Select **Create ruleset**: | ||
- Enter a name for the ruleset. | ||
- Select **Create ruleset** to confirm. | ||
3. When the rule creation section opens, select one of the following rule types: | ||
- **Pin**: Pin selected documents to the top of the search results. | ||
- **Exclude**: Exclude selected documents from the results. | ||
|
||
For more information on rule types, refer [Rule types](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules#query-rule-type). | ||
4. Select one or more documents for the rule to apply to. | ||
5. Select one of the following rule criteria: | ||
- **Always**: Apply the rule to all queries | ||
- **Custom**: Define conditions when the rule is applied. | ||
|
||
For a full list of options, refer [Rule criteria](elasticsearch://reference/elasticsearch/rest-apis/searching-with-query-rules.md#query-rule-criteria). | ||
6. Select **Create rule**. | ||
7. Select **Save** in the top right corner of the ruleset section. | ||
|
||
:::{note} | ||
Each ruleset must contain at least one rule. | ||
::: | ||
|
||
### Delete a ruleset | ||
Use the following steps to delete a query ruleset: | ||
1. Select **Query Rules** in the navigation menu under **Relevance**. | ||
2. Select **Delete** or select it from the action menu (**...**). | ||
3. Select if the ruleset is safe to delete. | ||
4. Select **Delete ruleset**. | ||
|
||
### Manage existing rules | ||
The following sections describe how to edit, delete, and re-order rules: | ||
|
||
#### Edit a rule | ||
Use the following steps to edit a query rule: | ||
1. Select **Query Rules** in the navigation menu under **Relevance**. | ||
2. Select a ruleset. | ||
3. Select **Edit** from the action menu (**...**). | ||
4. Apply changes to the rule. | ||
5. Select **Update rule** to confirm your changes. | ||
6. Select **Save** in the top right corner of the ruleset section. | ||
|
||
:::{important} | ||
Don't forget to save your changes, because unsaved rules are not applied. | ||
::: | ||
|
||
#### Delete a rule | ||
Use the following steps to delete a query rule: | ||
1. Select **Query Rules** in the navigation menu under **Relevance**. | ||
2. Select a ruleset. | ||
3. Select **Delete rule** from the action menu (**...**) | ||
4. Select **Delete rule**. | ||
5. Select **Save** in the top right corner of the ruleset section. | ||
|
||
#### Re-order rules | ||
Use the following steps to re-order query rules: | ||
1. Select **Query Rules** in the navigation menu under **Relevance**. | ||
2. Select a ruleset. | ||
3. Drag a rule using the handle icon (≡) on the left. | ||
4. Drop it in the new position. | ||
5. Select **Save** in the top right corner of the ruleset section. | ||
|
||
### Test and validate a ruleset | ||
To test a query ruleset, do the following: | ||
1. Select **Query Rules** in the navigation menu under **Relevance**. | ||
2. Select a ruleset. | ||
3. Select **Test in Console**. | ||
4. Run the query. | ||
5. Review results to confirm if the rule actions were applied as expected. | ||
|
||
|
||
## Learn more | ||
|
||
Following resources can help you understand query rules better: | ||
ketkee-aryamane marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Blogs: | ||
|
||
- [Query rules blog](https://www.elastic.co/search-labs/blog/elasticsearch-query-rules-generally-available) | ||
- [Semantic search for query rules](https://www.elastic.co/search-labs/blog/semantic-search-query-rules) | ||
|
||
Other documentation links: | ||
- [Query Rules API]({{es-apis}}group/endpoint-query_rules) | ||
- [Search using query rules](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules) | ||
- [Rule types](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules#query-rule-type) | ||
- [Rule criteria](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules#query-rule-criteria) | ||
- [Rule actions](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules#query-rule-actions) | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect, we only support pinning or excluding. When I read boost I don't think of pinning documents, I think of increasing the likelihood that they show up in the results, and unfortunately this is not supported. You could consider linking here to https://www.elastic.co/docs/reference/elasticsearch/rest-apis/searching-with-query-rules for more information about query rules as well. (I know you link to it further down)