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

Unsupported action found at bulk response. #29

Open
johnchienbronci opened this issue Mar 30, 2022 · 1 comment
Open

Unsupported action found at bulk response. #29

johnchienbronci opened this issue Mar 30, 2022 · 1 comment

Comments

@johnchienbronci
Copy link

johnchienbronci commented Mar 30, 2022

Hi,

elasticlient lib version: version-02
elastic-search version: 7.17.0

I'm bulk perform fail and without error.
Checking log found a msg: Unsupported 'action' found at bulk response.

deatail log:

Host response text: {
  "took": 0,
  "errors": true,
  "items": [
    {
      "create": {
        "_index": ".ds-game-of-thrones-a-2022.04.06-000032",
        "_type": "_doc",
        "_id": "docId_c",
        "status": 409,
        "error": {
          "type": "version_conflict_engine_exception",
          "reason": "[docId_c]: version conflict, document already exists (current version [1])",
          "index_uuid": "1pbbHdwvQyKv55pxEqUjjg",
          "shard": "0",
          "index": ".ds-game-of-thrones-a-2022.04.06-000032"
        }
      }
    }
  ]
}

Host response size: 406
Unsupported 'action' found at bulk response.
@johnchienbronci
Copy link
Author

File: src/Bulk.cc
function: processResult()
Find: // process items responses and replace it

    // process items responses
    const char *itemKeyName = nullptr;
    for (const Json::Value &item: items) {
        if (!item.isObject()) {
            LOG(LogLevel::WARNING, "Bulk items responses have to be objects!");
            continue;
        }

        // check index action response
        itemKeyName = nullptr;
        if (item.isMember("index") == true) itemKeyName = "index";
        else if (item.isMember("create") == true) itemKeyName = "create";
        if (itemKeyName != nullptr) {
            const Json::Value &res = item[itemKeyName];
            if (!res.isObject()) {
                LOG(LogLevel::WARNING, "Bulk response has unexpected format, "
                                       "object was expected.");
                continue;
            }
            // read status code
            const Json::Value &status = res.get("status", Json::Int(500));
            if (!status.isNumeric()) {
                LOG(LogLevel::WARNING, "Bulk response was expected to have numeric status. "
                                       "Skipping this response checking.");
                continue;
            }

            // if status code is not 2xx family, consider it as error
            if (status.asInt() / 100 != 2) {
                errCount++;
            }
        } else {
            LOG(LogLevel::WARNING, "Unsupported 'action' found at bulk response.");

        }
    }

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

No branches or pull requests

1 participant