Cannot get indices from sub-request SubRequestContext when using bulk

hi,
i’m trying bulk on ES 2.3.5 and get an error.

the ROR part from the elasticsearch.yml is :

readonlyrest:
enable: true
response_if_req_forbidden: Forbidden by ReadonlyREST ES plugin

access_control_rules:

- name: Accept requests from users in group team1 on index1
  type: allow
  groups: ["team1"]
  actions: ["indices:admin/*","indices:data/read/*","indices:data/write/*","cluster:monitor/*","indices:monitor/*"]
  indices: ["index1*"]

- name: Admin group to rule them all
  type: allow
  groups: ["admin"]
  actions: ["cluster:admin/*","cluster:monitor/*","indices:admin/*","indices:data/*","indices:monitor/*","internal:indices/*"]

users:

- username: user1
  auth_key: user1:pw1
  groups: ["team1"]
  
- username: adm
  auth_key: adm:adm
  groups: ["admin"]

the file my.json is :
{index:{"_index":“index1”,"_type":“t1”}}
{“f1”:“101”,“f2”:“101”}
{index:{"_index":“index1”,"_type":“t1”}}
{“f1”:“102”,“f2”:“102”}
{index:{"_index":“index1”,"_type":“t1”}}
{“f1”:“103”,“f2”:“103”}
{index:{"_index":“index1”,"_type":“t1”}}
{“f1”:“104”,“f2”:“104”}
{index:{"_index":“index1”,"_type":“t1”}}
{“f1”:“105”,“f2”:“105”}

the bulk command i run is :
curl -XPUT localhost:9200/_bulk --data-binary @c:\temp\my.json

the error from the command is :

{
“error”:
{
“root_cause”:
[
{
“type”:“r_r_context_exception”,
“reason”:“Cannot get indices from sub-request SubRequestContext”
}
],
“type”:“r_r_context_exception”,
“reason”:“Cannot get indices from sub-request SubRequestContext”
},
“status”:500
}

and the part from the log file is :
[2017-07-26 07:52:42,865][INFO ][plugin.readonlyrest.acl.blocks.rules.impl] found 5 subrequests
[2017-07-26 07:52:42,867][WARN ][rest.suppressed ] path: /_bulk, params: {}
RRContextException[Cannot get indices from sub-request SubRequestContext]
at org.elasticsearch.plugin.readonlyrest.wiring.requestcontext.SubRCTransactionalIndices.initialize(SubRCTransactionalIndices.java:56)
at org.elasticsearch.plugin.readonlyrest.wiring.requestcontext.SubRCTransactionalIndices.initialize(SubRCTransactionalIndices.java:34)
at org.elasticsearch.plugin.readonlyrest.wiring.requestcontext.Transactional.lazyLoad(Transactional.java:66)
.
please advice
.

Looks like an ancient version… Can you check?

cat plugins/readonlyrest/plugin-descriptor.properties |grep version

the version is 1.15.0

the bulk action is :
indices:data/write/bulk

and at the yml file i have the action :
“indices:data/write/*”

it should cover the bulk operation isn’t it ?

It’s a defect of that outdated version. Any chance of upgrading to Elasticsearch 2.4.5?

we are planning to upgrade to 5 but not in the near future

1 Like