Переглянути джерело

[DOCS] Document `toJSON` function for role query (#62257)

James Rodewig 5 роки тому
батько
коміт
4ba7c408f7

+ 24 - 1
x-pack/docs/en/security/authorization/role-templates.asciidoc

@@ -66,4 +66,27 @@ POST /_security/role/example2
     }
   ]
 }
---------------------------------------------------
+--------------------------------------------------
+
+If your metadata field contains an object or array, you can access it using the
+`{{#toJson}}parameter{{/toJson}}` function.
+
+[source,console]
+----
+POST /_security/role/example3
+{
+  "indices" : [
+    {
+      "names" : [ "my-index-000001" ],
+      "privileges" : [ "read" ],
+      "query" : {
+        "template" : {
+          "source" : {
+            "terms" : { "group.statuses" : "{{#toJson}}_user.metadata.statuses{{/toJson}}" }
+          }
+        }
+      }
+    }
+  ]
+}
+----