Role Definition Error (immense term in indices.query)

Hi - I'm getting an exception when trying to create a role with document-level security via the REST API. The reason seems to be "query" getting larger than 32766 bytes. The request body and stracktrace are below. Can you please suggest a solution or workaround? Thanks!

Request:
{
"cluster" : [ ],
"indices" : [ {
"names" : [ "test-index" ],
"privileges" : [ "read" ],
"query" : " A LARGE JSON HERE"
} ],
"metadata" : {
"last_update_time" : "2017-10-18T16:23:52.102",
"application" : "myapp"
},
"run_as" : [ ]
}

Exception:
org.elasticsearch.client.ResponseException: POST http://localhost:9200/_xpack/security/role/testuser: HTTP/1.1 400 Bad Request
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Document contains at least one immense term in field="indices.query" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[123, 34, 98, 111, 111, 108, 34, 58, 123, 34, 109, 105, 110, 105, 109, 117, 109, 95, 115, 104, 111, 117, 108, 100, 95, 109, 97, 116, 99, 104]...', original message: bytes can be at most 32766 in length; got 45939"}],"type":"illegal_argument_exception","reason":"Document contains at least one immense term in field="indices.query" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[123, 34, 98, 111, 111, 108, 34, 58, 123, 34, 109, 105, 110, 105, 109, 117, 109, 95, 115, 104, 111, 117, 108, 100, 95, 109, 97, 116, 99, 104]...', original message: bytes can be at most 32766 in length; got 45939","caused_by":{"type":"max_bytes_length_exceeded_exception","reason":"bytes can be at most 32766 in length; got 45939"}},"status":400}
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:354)
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:343)
at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119)
:
:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.