Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support bulk delete requests #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ckoch-cars
Copy link

@ckoch-cars ckoch-cars commented Jul 12, 2023

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.
Copy link

@leepage87 leepage87 left a comment

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