Skip to content

Instantly share code, notes, and snippets.

@bertvermeiren
Created April 20, 2015 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertvermeiren/c29e0d9ee54bb5b0b73a to your computer and use it in GitHub Desktop.
Save bertvermeiren/c29e0d9ee54bb5b0b73a to your computer and use it in GitHub Desktop.
SHIELD terms lookup filter AuthorizationException BUG
# Add user 'admin' with default 'admin' role.
./bin/shield/esusers useradd admin -p admin1 -r admin
# create index.
curl -XPUT 'admin:admin1@localhost:9200/customer'
# create a document on the index
curl -XPUT 'admin:admin1@localhost:9200/customer/external/1' -d '
{
"name" : "John Doe",
"token" : "token1"
}'
# create additional index for the "terms lookup" filter functionality
curl -XPUT 'admin:admin1@localhost:9200/tokens'
# create document in 'tokens' index
curl -XPUT 'admin:admin1@localhost:9200/tokens/tokens/1' -d '
{
"group" : "1",
"tokens" : ["token1", "token2" ]
}'
# search with a terms lookup filter on the "customer" index, referring to the 'tokens' index.
curl -XGET 'admin:admin1@localhost:9200/customer/external/_search' -d '
{
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"terms": {
"token": {
"index": "tokens",
"type": "tokens",
"id": "1",
"path": "tokens"
}
}
}
}
}
}'
=> org.elasticsearch.shield.authz.AuthorizationException: action [indices:data/read/get] is unauthorized for user [__es_system_user]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment