Bulk write to multiple aliases throws 500 error starting in 5.5.3

Elasticsearch version (bin/elasticsearch --version): 5.5.3

Plugins installed: x-pack (it comes with the docker version of ES)

JVM version (java -version):
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-b16)
OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)

OS version (uname -a if on a Unix-like system): docker image uses centos:7
Linux cf214e385aa3 4.10.0-33-generic #37-Ubuntu SMP Fri Aug 11 10:55:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:

Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

  1. spin up a 5.5.3 ES instance with docker: docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.5.3
  2. run this script:
#!/usr/bin/env bash

# creates an index called my-data with 2 write aliases: write-alias-1 and write-alias-2
curl -u "elastic:changeme" -XPUT "http://localhost:9200/my-data" -H 'Content-Type: application/json' -d'
{
  "aliases": {
    "write-index-1": {},
    "write-index-2": {}
  }
}
'

# bulk writes 2 documents using the same _id but with different write aliases
curl -u "elastic:changeme" -XPOST "http://localhost:9200/_bulk?pretty" -H 'Content-Type: application/json' -d'
{"index":{"_index": "write-index-1","_type": "data", "_id": "1"}}
{"hello": "hello1"}
{"index":{"_index": "write-index-2","_type": "data", "_id": "1"}}
{"hello": "hello2"}
'

Provide logs (if relevant):
output from the bulk call:

{
  "took" : 0,
  "errors" : true,
  "items" : [
    {
      "index" : {
        "_index" : "my-data",
        "_type" : "data",
        "_id" : "1",
        "status" : 500,
        "error" : {
          "type" : "illegal_state_exception",
          "reason" : "Action indices:data/write/bulk[s] should operate on exactly 1 local index but was 2"
        }
      }
    },
    {
      "index" : {
        "_index" : "my-data",
        "_type" : "data",
        "_id" : "1",
        "status" : 500,
        "error" : {
          "type" : "illegal_state_exception",
          "reason" : "Action indices:data/write/bulk[s] should operate on exactly 1 local index but was 2"
        }
      }
    }
  ]
}

ES does not produce any logs with default logging level.

with 5.5.2 the script works as expected and the bulk writes return 200 level statuses

I initially opened an issue in the open source github elasticsearch repo, (https://github.com/elastic/elasticsearch/issues/26975) but was redirected to open one here

I moved your question to #elasticsearch as I don't think it's related to x-pack plugin here.

It looks like to me a bug as the write-index-1 points only to my-data. Same for the other alias.

Could you open an issue?

This is definitely an X-Pack issue.

I'll file an internal issue for it, and see what we can do to resolve it.

He did open an issue, as he mentioned, and I directed him here because this is 100% an X-Pack only issue. I moved this back to the X-Pack category.

@BradHarris I’m sorry for the run around here, I appreciate your patience, I thank you for bringing this to our attention. We have indeed (@TimV has) opened an issue internally and have a fix in the review phase.

Haha! Thanks @jasontedor

Thanks for your help @jasontedor @TimV @dadoonet ! You guys are fast!

1 Like

You're welcome @BradHarris. Thanks for the report.

1 Like

@BradHarris

Elasticsearch 5.6.4 was released today and contains a fix for this issue.
It would be great if you could confirm that this release resolves the problem for you.

Fixed authorization issues for bulk requests that use index aliases.

Thanks,
Tim

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.