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

This commit is contained in:
James Rodewig 2020-09-16 10:38:56 -04:00 committed by GitHub
parent 61ea9af25b
commit 6394629b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 1 deletions

View File

@ -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}}" }
}
}
}
}
]
}
----