Skip to content

support bulk delete requests#115

Open
ck-work00 wants to merge 1 commit into
danielberkompas:masterfrom
carsdotcom:support-bulk-delete-actions
Open

support bulk delete requests#115
ck-work00 wants to merge 1 commit into
danielberkompas:masterfrom
carsdotcom:support-bulk-delete-actions

Conversation

@ck-work00

@ck-work00 ck-work00 commented Jul 12, 2023

Copy link
Copy Markdown

When the encoded struct 'document' is appended to a bulk request performing a delete operation, it causes the bulk request to fail.

As a failing curl:

curl -X PUT "localhost:9200/my-test-index/_bulk?pretty" -v -H 'Content-Type: application/json' -d'
{"delete":{"_id":"8dc97b1d-55f0-4651-810f-ca7c23fa7c59","_index":"my-test-index"}}
{"struct":null,"document":null,"body":null}
'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Malformed action/metadata line [3], expected START_OBJECT or END_OBJECT but found [VALUE_NULL]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Malformed action/metadata line [3], expected START_OBJECT or END_OBJECT but found [VALUE_NULL]"
  },
  "status" : 400
}

As a success curl:

curl -X PUT "localhost:9200/my-test-index/_bulk?pretty" -v -H 'Content-Type: application/json' -d'
{"delete":{"_id":"8dc97b1d-55f0-4651-810f-ca7c23fa7c59","_index":"my-test-index"}}
'
{
  "took" : 0,
  "errors" : true,
  "items" : [
    {
      "delete" : {
        "_index" : "my-test-index",
        "_type" : "_doc",
        "_id" : "8dc97b1d-55f0-4651-810f-ca7c23fa7c59",
        "status" : 404,
        "error" : {
          "type" : "index_not_found_exception",
          "reason" : "no such index [my-test-index]",
          "resource.type" : "index_expression",
          "resource.id" : "my-test-index",
          "index_uuid" : "_na_",
          "index" : "my-test-index"
        }
      }
    }
  ]
}

When the encoded struct 'document' is appended to a bulk request, it causes the bulk request to fail.

@leepage87 leepage87 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been using this same code in production on our fork for over 3 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants