瀏覽代碼

[DOCS] Reformat script query (#44882)

James Rodewig 6 年之前
父節點
當前提交
3be9a3bd2c
共有 1 個文件被更改,包括 27 次插入14 次删除
  1. 27 14
      docs/reference/query-dsl/script-query.asciidoc

+ 27 - 14
docs/reference/query-dsl/script-query.asciidoc

@@ -4,12 +4,15 @@
 <titleabbrev>Script</titleabbrev>
 ++++
 
-A query allowing to define
-<<modules-scripting,scripts>> as queries. They are typically used in a filter
-context, for example:
+Filters documents based on a provided <<modules-scripting-using,script>>. The
+`script` query is typically used in a <<query-filter-context,filter context>>.
+
+
+[[script-query-ex-request]]
+==== Example request
 
 [source,js]
-----------------------------------------------
+----
 GET /_search
 {
     "query": {
@@ -25,18 +28,29 @@ GET /_search
         }
     }
 }
-----------------------------------------------
+----
 // CONSOLE
 
-[float]
-==== Custom Parameters
 
-Scripts are compiled and cached for faster execution. If the same script
-can be used, just with different parameters provider, it is preferable
-to use the ability to pass parameters to the script itself, for example:
+[[script-top-level-params]]
+==== Top-level parameters for `script`
+
+`script`::
+(Required, <<modules-scripting-using, script object>>) Contains a script to run
+as a query. This script must return a boolean value, `true` or `false`.
+
+[[script-query-notes]]
+==== Notes
+
+[[script-query-custom-params]]
+===== Custom Parameters
+
+Like <<query-filter-context,filters>>, scripts are cached for faster execution.
+If you frequently change the arguments of a script, we recommend you store them
+in the script's `params` parameter. For example:
 
 [source,js]
-----------------------------------------------
+----
 GET /_search
 {
     "query": {
@@ -55,6 +69,5 @@ GET /_search
         }
     }
 }
-----------------------------------------------
-// CONSOLE
-
+----
+// CONSOLE