Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit 0f42f29

Browse files
committed
plugin setting doc
1 parent d960f62 commit 0f42f29

File tree

1 file changed

+253
-0
lines changed

1 file changed

+253
-0
lines changed

docs/sql/settings.md

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
# Plugin Settings
2+
3+
## Introduction
4+
5+
When Elasticsearch bootstraps, SQL plugin will register a few settings
6+
in Elasticsearch cluster settings. Most of the settings are able to
7+
change dynamically so you can control the behavior of SQL plugin without
8+
need to bounce your cluster.
9+
10+
## opendistro.sql.enabled
11+
12+
### Description
13+
14+
You can disable SQL plugin to reject all coming requests.
15+
16+
1. The default value is true.
17+
2. This setting is node scope.
18+
3. This setting can be updated dynamically.
19+
20+
### Example 1
21+
22+
You can update the setting with a new value like this.
23+
24+
SQL query:
25+
26+
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_cluster/settings -d '{
27+
"transient" : {
28+
"opendistro.sql.enabled" : false
29+
}
30+
}'
31+
32+
Result set:
33+
34+
{
35+
"acknowledged" : true,
36+
"persistent" : { },
37+
"transient" : {
38+
"opendistro" : {
39+
"sql" : {
40+
"enabled" : "false"
41+
}
42+
}
43+
}
44+
}
45+
46+
### Example 2
47+
48+
Query result after the setting updated is like:
49+
50+
SQL query:
51+
52+
>> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opendistro/_sql -d '{
53+
"query" : "SELECT * FROM accounts"
54+
}'
55+
56+
Result set:
57+
58+
{
59+
"error" : {
60+
"reason" : "Invalid SQL query",
61+
"details" : "Either opendistro.sql.enabled or rest.action.multi.allow_explicit_index setting is false",
62+
"type" : "SQLFeatureDisabledException"
63+
},
64+
"status" : 400
65+
}
66+
67+
## opendistro.sql.query.slowlog
68+
69+
### Description
70+
71+
You can configure the time limit (seconds) for slow query which would be
72+
logged as 'Slow query: elapsed=xxx (ms)' in elasticsearch.log.
73+
74+
1. The default value is 2.
75+
2. This setting is node scope.
76+
3. This setting can be updated dynamically.
77+
78+
### Example
79+
80+
You can update the setting with a new value like this.
81+
82+
SQL query:
83+
84+
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_cluster/settings -d '{
85+
"transient" : {
86+
"opendistro.sql.query.slowlog" : 10
87+
}
88+
}'
89+
90+
Result set:
91+
92+
{
93+
"acknowledged" : true,
94+
"persistent" : { },
95+
"transient" : {
96+
"opendistro" : {
97+
"sql" : {
98+
"query" : {
99+
"slowlog" : "10"
100+
}
101+
}
102+
}
103+
}
104+
}
105+
106+
## opendistro.sql.query.analysis.enabled
107+
108+
### Description
109+
110+
You can disable query analyzer to bypass strict syntactic and semantic
111+
analysis.
112+
113+
1. The default value is true.
114+
2. This setting is node scope.
115+
3. This setting can be updated dynamically.
116+
117+
### Example
118+
119+
You can update the setting with a new value like this.
120+
121+
SQL query:
122+
123+
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_cluster/settings -d '{
124+
"transient" : {
125+
"opendistro.sql.query.analysis.enabled" : false
126+
}
127+
}'
128+
129+
Result set:
130+
131+
{
132+
"acknowledged" : true,
133+
"persistent" : { },
134+
"transient" : {
135+
"opendistro" : {
136+
"sql" : {
137+
"query" : {
138+
"analysis" : {
139+
"enabled" : "false"
140+
}
141+
}
142+
}
143+
}
144+
}
145+
}
146+
147+
## opendistro.sql.query.analysis.semantic.suggestion
148+
149+
### Description
150+
151+
You can enable query analyzer to suggest correct field names for quick
152+
fix.
153+
154+
1. The default value is false.
155+
2. This setting is node scope.
156+
3. This setting can be updated dynamically.
157+
158+
### Example 1
159+
160+
You can update the setting with a new value like this.
161+
162+
SQL query:
163+
164+
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_cluster/settings -d '{
165+
"transient" : {
166+
"opendistro.sql.query.analysis.semantic.suggestion" : true
167+
}
168+
}'
169+
170+
Result set:
171+
172+
{
173+
"acknowledged" : true,
174+
"persistent" : { },
175+
"transient" : {
176+
"opendistro" : {
177+
"sql" : {
178+
"query" : {
179+
"analysis" : {
180+
"semantic" : {
181+
"suggestion" : "true"
182+
}
183+
}
184+
}
185+
}
186+
}
187+
}
188+
}
189+
190+
### Example 2
191+
192+
Query result after the setting updated is like:
193+
194+
SQL query:
195+
196+
>> curl -H 'Content-Type: application/json' -X POST localhost:9200/_opendistro/_sql -d '{
197+
"query" : "SELECT first FROM accounts"
198+
}'
199+
200+
Result set:
201+
202+
{
203+
"error" : {
204+
"reason" : "Invalid SQL query",
205+
"details" : "Field [first] cannot be found or used here. Did you mean [firstname]?",
206+
"type" : "SemanticAnalysisException"
207+
},
208+
"status" : 400
209+
}
210+
211+
## opendistro.sql.query.analysis.semantic.threshold
212+
213+
### Description
214+
215+
Because query analysis needs to build semantic context in memory, index
216+
with large number of field would be skipped. You can update it to apply
217+
analysis to smaller or larger index as needed.
218+
219+
1. The default value is 200.
220+
2. This setting is node scope.
221+
3. This setting can be updated dynamically.
222+
223+
### Example
224+
225+
You can update the setting with a new value like this.
226+
227+
SQL query:
228+
229+
>> curl -H 'Content-Type: application/json' -X PUT localhost:9200/_cluster/settings -d '{
230+
"transient" : {
231+
"opendistro.sql.query.analysis.semantic.threshold" : 50
232+
}
233+
}'
234+
235+
Result set:
236+
237+
{
238+
"acknowledged" : true,
239+
"persistent" : { },
240+
"transient" : {
241+
"opendistro" : {
242+
"sql" : {
243+
"query" : {
244+
"analysis" : {
245+
"semantic" : {
246+
"threshold" : "50"
247+
}
248+
}
249+
}
250+
}
251+
}
252+
}
253+
}

0 commit comments

Comments
 (0)