Description
To be able to access restrict the usage of ES the settings rest.action.multi.allow_explicit_index should be set to false, this will make it possible to disallow _bulk-operations where the index are included in the bulk-operations. (elastic/elasticsearch#3636)
example on current request
POST /index1/testindex/_bulk
{ "index" : {"_index":"index1","_type":"testindex"} }
{"document-id":"1","answercount":"8"}
{ "index" : {"_index":"index1","_type":"testindex"} }
{"document-id":"2","answercount":"32"}
the server will then respond with
{"error":"ElasticsearchIllegalArgumentException[explicit index in bulk is not allowed]","status":400}
To get this to work the request should be without the _index and _type in the body or the value should be null.
POST /index1/testindex/_bulk
{ "index" : {"_type":"testindex"} }
{"document-id":"1","answercount":"8"}
{ "index" : {"_index":null,"_type":"testindex"} }
{"document-id":"2","answercount":"32"}
When I look into the src of NEST the NestSerializer.SerializeBulkDescriptor-method automatic assign the index and type a value if it not already are set, this make it impossible to get them as null.
What is the best solution to solve the problem? Settings on IConnectionSettings so that automatic assigning values to the index can be turned on/off for the ElasticSearchClient, settings should be used for the bulk and multiserach operations.