Skip to content

Commit 3e95f5f

Browse files
deshsiddkolchfa-awsnatebower
authored
Documentation for query field name and datatype in query shape (#8631)
* Documentation for query field name and datatype in query shape Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Address review dog comments Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> * Doc review Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Update _observing-your-data/query-insights/grouping-top-n-queries.md Co-authored-by: Nathan Bower <nbower@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> * Rewording Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> --------- Signed-off-by: Siddhant Deshmukh <deshsid@amazon.com> Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: Fanit Kolchina <kolchfa@amazon.com> Co-authored-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: Nathan Bower <nbower@amazon.com>
1 parent 98ae0de commit 3e95f5f

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

_observing-your-data/query-insights/grouping-top-n-queries.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,96 @@ bool
4545

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

48+
## Configuring the query structure
49+
50+
The preceding example query shows a simplified query structure. By default, the query structure also includes field names and field data types.
51+
52+
For example, consider an index `index1` with the following field mapping:
53+
54+
```json
55+
"mappings": {
56+
"properties": {
57+
"field1": {
58+
"type": "keyword"
59+
},
60+
"field2": {
61+
"type": "text"
62+
},
63+
"field3": {
64+
"type": "text"
65+
},
66+
"field4": {
67+
"type": "long"
68+
}
69+
}
70+
}
71+
```
72+
73+
If you run the following query on this index:
74+
75+
```json
76+
{
77+
"query": {
78+
"bool": {
79+
"must": [
80+
{
81+
"term": {
82+
"field1": "example_value"
83+
}
84+
}
85+
],
86+
"filter": [
87+
{
88+
"match": {
89+
"field2": "search_text"
90+
}
91+
},
92+
{
93+
"range": {
94+
"field4": {
95+
"gte": 1,
96+
"lte": 100
97+
}
98+
}
99+
}
100+
],
101+
"should": [
102+
{
103+
"regexp": {
104+
"field3": ".*"
105+
}
106+
}
107+
]
108+
}
109+
}
110+
}
111+
```
112+
113+
Then the query has the following corresponding query structure:
114+
115+
```c
116+
bool []
117+
must:
118+
term [field1, keyword]
119+
filter:
120+
match [field2, text]
121+
range [field4, long]
122+
should:
123+
regexp [field3, text]
124+
```
125+
126+
To exclude field names and field data types from the query structure, configure the following settings:
127+
128+
```json
129+
PUT _cluster/settings
130+
{
131+
"persistent" : {
132+
"search.insights.top_queries.grouping.attributes.field_name" : false,
133+
"search.insights.top_queries.grouping.attributes.field_type" : false
134+
}
135+
}
136+
```
137+
{% include copy-curl.html %}
48138

49139
## Aggregate metrics per group
50140

_observing-your-data/query-insights/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ title: Query insights
44
nav_order: 40
55
has_children: true
66
has_toc: false
7+
redirect_from:
8+
- /query-insights/
79
---
810

911
# Query insights

0 commit comments

Comments
 (0)