Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PUT my_index
{
"mappings": {
"properties": {
"securityTags": {
"type": "keyword",
"fields": {
"length": {
"type": "token_count",
"analyzer": "standard"
}
}
}
}
}
}
POST /my_index/1
{
"sensitiveData": "Dave Erickson lives in Wahshington DC"
"securityTags": ["DaveLocation", "DaveFullName"]
}
POST /_xpack/security/role/dave_security_role
{
cluster: [],
"indices": [
{
"names": ["my_index"],
"privileges": ["read"],
"query": {
"terms_set": {
"securityTags": {
terms: ["DaveFullName", "DaveLocation", "DaveCatNames"],
minimum_should_match_field: "securityTags.length"
}
}
}
}
]
}
@mbarretta

This comment has been minimized.

Copy link

commented Mar 27, 2018

@derickson The problem with the token_count is that it's counting tokens, not counting the length of the securityTags list. See this full example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.