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

Documentation for query field name and datatype in query shape #8631

Merged
Merged
Show file tree
Hide file tree
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
90 changes: 90 additions & 0 deletions _observing-your-data/query-insights/grouping-top-n-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,96 @@ bool

When queries share the same query structure, they are grouped together, ensuring that all similar queries belong to the same group.

## Configuring the query structure

The preceding example query shows a simplified query structure. By default, the query structure also includes field names and field data types.

For example, consider an index `index1` with the following field mapping:

```json
"mappings": {
"properties": {
"field1": {
"type": "keyword"
},
"field2": {
"type": "text"
},
"field3": {
"type": "text"
},
"field4": {
"type": "long"
}
}
}
```

If you run the following query on this index:

```json
{
"query": {
"bool": {
"must": [
{
"term": {
"field1": "example_value"
}
}
],
"filter": [
{
"match": {
"field2": "search_text"
}
},
{
"range": {
"field4": {
"gte": 1,
"lte": 100
}
}
}
],
"should": [
{
"regexp": {
"field3": ".*"
}
}
]
}
}
}
```

Then the query has the following corresponding query structure:

```c
bool []
must:
term [field1, keyword]
filter:
match [field2, text]
range [field4, long]
should:
regexp [field3, text]
```

To exclude field names and field data types from the query structure, configure the following settings:

```json
PUT _cluster/settings
{
"persistent" : {
"search.insights.top_queries.grouping.attributes.field_name" : false,
"search.insights.top_queries.grouping.attributes.field_type" : false
}
}
```
{% include copy-curl.html %}

## Aggregate metrics per group

Expand Down
2 changes: 2 additions & 0 deletions _observing-your-data/query-insights/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ title: Query insights
nav_order: 40
has_children: true
has_toc: false
redirect_from:
- /query-insights/
---

# Query insights
Expand Down
Loading