anthonygauthier/jmeter-elasticsearch-backend-listener

plugin cannot write to datastream. response from elasticsearch "only write ops with an op_type of create are allowed in data streams""

Spoonsk opened this issue · 1 comments

When using this plugin and attempting to write to a datastream index we get the following response:

{
    "took": 0,
    "ingest_took": 0,
    "errors": true,
    "items": [
        {
            "index": {
                "_index": "myindex",
                "_type": "_doc",
                "_id": null,
                "status": 400,
                "error": {
                    "type": "illegal_argument_exception",
                    "reason": "only write ops with an op_type of create are allowed in data streams"
                }
            }
        }
    ]
}

this is because datastream indexes only support write operations. The current code uses an index operation when sending the bulk requests.

Changing this:
public static String SEND_BULK_REQUEST = "{ \"index\" : { \"_index\" : \"%s\" } }%n";

To this:
public static String SEND_BULK_REQUEST = "{ \"create\" : { \"_index\" : \"%s\" } }%n";

should allow it to support datastream indexes without compromising other functionality

@Spoonsk Thanks for the contribution! I gotta say it's been a while since we've had a PR around here 😅

I'll check it out later on my laptop