Created
October 11, 2017 16:55
-
-
Save derickson/300e1d6d026500b3ea59d015de2c5ec2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
| } | |
| } | |
| } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@derickson The problem with the
token_countis that it's counting tokens, not counting the length of thesecurityTagslist. See this full example