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

_bulk request with action.auto_create_index configured doesn't return the right bulk response #24028

Closed
ph opened this issue Apr 10, 2017 · 0 comments
Assignees
Labels
:Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >regression v5.4.0 v6.0.0-alpha1

Comments

@ph
Copy link
Contributor

ph commented Apr 10, 2017

Elasticsearch version: 5.3.0

Description of the problem including expected versus actual behavior:

When whitelisting index name using the action.auto_create_index and sending a bulk request to ES with a forbidden index name doesn't return the expected bulk response.

The response is missing a items fields, allowing us to check if each document succeeded or not

more details at logstash-plugins/logstash-output-elasticsearch#584

Steps to reproduce:

  1. Adding the following to the elasticsearch.yml
 action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*
  1. using this json document.
cat /tmp/x
{"index":{"_id":null,"_index":".logstash-2017.04.08","_type":"stdin","_routing":null}}
{"@timestamp":"2017-04-09T10:34:25.253Z","@version":"1","host":"localhost.localdomain","message":"testing","type":"stdin"}
curl -D- --data-binary @/tmp/x localhost:9200/_bulk?pretty
HTTP/1.1 404 Not Found
Warning: 299 Elasticsearch-5.3.0-3adb13b "Content type detection for rest requests is deprecated. Specify the content type using the [Content-Type] header." "Mon, 10 Apr 2017 19:46:17 GMT"
content-type: application/json; charset=UTF-8
content-length: 612

{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index and [action.auto_create_index] ([.security,.monitoring*,.watches,.triggered_watches,.watcher-history*]) doesn't match",
        "index_uuid" : "_na_",
        "index" : ".logstash-2017.04.08"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index and [action.auto_create_index] ([.security,.monitoring*,.watches,.triggered_watches,.watcher-history*]) doesn't match",
    "index_uuid" : "_na_",
    "index" : ".logstash-2017.04.08"
  },
  "status" : 404
}

Tested in 5.1.2 returns a correct response:

% curl -D- --data-binary @/tmp/x localhost:9200/_bulk?pretty
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 496

{
  "took" : 0,
  "errors" : true,
  "items" : [
    {
      "index" : {
        "_index" : "logstash-2017.04.09",
        "_type" : "stdin",
        "_id" : null,
        "status" : 404,
        "error" : {
          "type" : "index_not_found_exception",
          "reason" : "no such index",
          "resource.type" : "index_expression",
          "resource.id" : "logstash-2017.04.09",
          "index_uuid" : "_na_",
          "index" : "logstash-2017.04.09"
        }
      }
    }
  ]
}
  1. If in a single bulk request you target 2 different index, it will return a single bulk response in the bulk

Request

{"index":{"_id":null,"_index":".logstash-2017.04.08","_type":"stdin","_routing":null}}
{"@timestamp":"2017-04-09T10:34:25.253Z","@version":"1","host":"localhost.localdomain","message":"testing","type":"stdin"}
{"index":{"_id":null,"_index":".monitoring-2017.04.08","_type":"stdin","_routing":null}}
{"@timestamp":"2017-04-09T10:34:25.253Z","@version":"1","host":"localhost.localdomain","message":"testing 2","type":"stdin"}

Response:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index and [action.auto_create_index] ([.security,.monitoring*,.watches,.triggered_watches,.watcher-history*]) doesn't match",
        "index_uuid" : "_na_",
        "index" : ".logstash-2017.04.08"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index and [action.auto_create_index] ([.security,.monitoring*,.watches,.triggered_watches,.watcher-history*]) doesn't match",
    "index_uuid" : "_na_",
    "index" : ".logstash-2017.04.08"
  },
  "status" : 404
}
@ph ph changed the title _bulk request with action.auto_create_index doesn't return the right bulk response _bulk request with action.auto_create_index configured doesn't return the right bulk response Apr 10, 2017
@nik9000 nik9000 self-assigned this Apr 10, 2017
nik9000 added a commit to nik9000/elasticsearch that referenced this issue Apr 11, 2017
Before elastic#22488 when an index couldn't be created during a `_bulk`
operation we'd do all the *other* actions and return the index
creation error on each failing action. In elastic#22488 we accidentally
cahnged it so that we now reject the entire bulk request if a single
action cannot create an index that it must create to run. This
gets reverts to the old behavior while still keeping the nicer
error messages. Instead of failing the entire request we now only
fail the portions of the request that can't work because the index
doesn't exist.

Closes elastic#24028
nik9000 added a commit that referenced this issue Apr 21, 2017
Before #22488 when an index couldn't be created during a `_bulk`
operation we'd do all the *other* actions and return the index
creation error on each failing action. In #22488 we accidentally
changed it so that we now reject the entire bulk request if a single
action cannot create an index that it must create to run. This
gets reverts to the old behavior while still keeping the nicer
error messages. Instead of failing the entire request we now only
fail the portions of the request that can't work because the index
doesn't exist.

Closes #24028
nik9000 added a commit that referenced this issue Apr 22, 2017
Before #22488 when an index couldn't be created during a `_bulk`
operation we'd do all the *other* actions and return the index
creation error on each failing action. In #22488 we accidentally
changed it so that we now reject the entire bulk request if a single
action cannot create an index that it must create to run. This
gets reverts to the old behavior while still keeping the nicer
error messages. Instead of failing the entire request we now only
fail the portions of the request that can't work because the index
doesn't exist.

Closes #24028
nik9000 added a commit that referenced this issue Apr 22, 2017
Before #22488 when an index couldn't be created during a `_bulk`
operation we'd do all the *other* actions and return the index
creation error on each failing action. In #22488 we accidentally
changed it so that we now reject the entire bulk request if a single
action cannot create an index that it must create to run. This
gets reverts to the old behavior while still keeping the nicer
error messages. Instead of failing the entire request we now only
fail the portions of the request that can't work because the index
doesn't exist.

Closes #24028
nik9000 added a commit that referenced this issue Apr 22, 2017
Before #22488 when an index couldn't be created during a `_bulk`
operation we'd do all the *other* actions and return the index
creation error on each failing action. In #22488 we accidentally
changed it so that we now reject the entire bulk request if a single
action cannot create an index that it must create to run. This
gets reverts to the old behavior while still keeping the nicer
error messages. Instead of failing the entire request we now only
fail the portions of the request that can't work because the index
doesn't exist.

Closes #24028
asettouf pushed a commit to asettouf/elasticsearch that referenced this issue Apr 23, 2017
Before elastic#22488 when an index couldn't be created during a `_bulk`
operation we'd do all the *other* actions and return the index
creation error on each failing action. In elastic#22488 we accidentally
changed it so that we now reject the entire bulk request if a single
action cannot create an index that it must create to run. This
gets reverts to the old behavior while still keeping the nicer
error messages. Instead of failing the entire request we now only
fail the portions of the request that can't work because the index
doesn't exist.

Closes elastic#24028
@lcawl lcawl added :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. and removed :Bulk labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >regression v5.4.0 v6.0.0-alpha1
Projects
None yet
Development

No branches or pull requests

4 participants