Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0c4b77b
add query rules gui page and the menu option
ketkee-aryamane Jul 24, 2025
0c02fb8
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 24, 2025
06fd408
Add query rules step-by-step examples
charlotte-hoblik Jul 24, 2025
be03bc3
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 24, 2025
0c3b66b
edits to the whole page
ketkee-aryamane Jul 24, 2025
ab2dc03
Merge remote-tracking branch 'origin/303-query-rules-gui' into 303-qu…
ketkee-aryamane Jul 24, 2025
a5a8915
remove unwanted line space
ketkee-aryamane Jul 24, 2025
b24aacc
minor edits
ketkee-aryamane Jul 24, 2025
7a16782
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 24, 2025
ca8cfb9
rephrase words
ketkee-aryamane Jul 24, 2025
b7fa613
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 24, 2025
7bd9670
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 25, 2025
6f7e006
fixed feedback
ketkee-aryamane Jul 25, 2025
0f3081c
fixed feedback
ketkee-aryamane Jul 25, 2025
64649dc
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 25, 2025
ccc0917
fixed feedback on deployment type
ketkee-aryamane Jul 25, 2025
5ebf6a3
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 25, 2025
227f6fd
Update explore-analyze/query-filter/tools/query-rules-gui.md
ketkee-aryamane Jul 25, 2025
601baff
Update explore-analyze/query-filter/tools/query-rules-gui.md
ketkee-aryamane Jul 25, 2025
79f0dd7
Update explore-analyze/query-filter/tools/query-rules-gui.md
ketkee-aryamane Jul 25, 2025
c8e2bf7
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 28, 2025
3d47890
fixed feedback comments
ketkee-aryamane Jul 28, 2025
c9c41f4
fixed feedback comments
ketkee-aryamane Jul 28, 2025
169d96e
fixed feedback comments
ketkee-aryamane Jul 28, 2025
6d2492f
Update solutions/search/query-rules-ui.md
ketkee-aryamane Jul 28, 2025
a5bae84
Update solutions/search/query-rules-ui.md
ketkee-aryamane Jul 28, 2025
ad4907b
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 28, 2025
243302f
fixed feedback comments
ketkee-aryamane Jul 28, 2025
fe7098b
fixed feedback comments
ketkee-aryamane Jul 28, 2025
81ec5f8
minor edits
ketkee-aryamane Jul 28, 2025
15cc98b
feedback comments
ketkee-aryamane Jul 28, 2025
c0abcb7
feedback comments
ketkee-aryamane Jul 28, 2025
fccfb0e
feedback comments
ketkee-aryamane Jul 28, 2025
32edd89
feedback comments
ketkee-aryamane Jul 28, 2025
d64ffa2
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 28, 2025
151789e
Edit admonition
charlotte-hoblik Jul 28, 2025
6ae8d76
Update solutions/search/query-rules-ui.md
ketkee-aryamane Jul 28, 2025
0d579b6
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 28, 2025
ace847e
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 29, 2025
e541b6c
feedback comments
ketkee-aryamane Jul 29, 2025
37e171b
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 29, 2025
aadc48c
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 29, 2025
3d54895
Remove screenshot
charlotte-hoblik Jul 29, 2025
f085f5a
Merge branch 'main' into 303-query-rules-gui
charlotte-hoblik Jul 29, 2025
f2c1691
Merge branch 'main' into 303-query-rules-gui
ketkee-aryamane Jul 29, 2025
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions solutions/search/query-rules-ui.md
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.
Copy link
Member

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)

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
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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?

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.
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should think about removing custom because some power user roles will have that by default, no?

* `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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace this with contact *your* administrator


:::{image} /solutions/images/elasticsearch-query-rules-ui-home.png
:alt: Landing page for Query Rules UI.
Copy link
Member

Choose a reason for hiding this comment

The 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:

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)



1 change: 1 addition & 0 deletions solutions/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ toc:
- file: search/search-applications/search-application-client.md
- file: search/apis-and-tools.md
- file: search/ai-assistant.md
- file: search/query-rules-ui.md
- file: observability.md
children:
- file: observability/get-started.md
Expand Down
Loading