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 REST API allows arbitrary fields after action #43774

Closed
pickypg opened this issue Jun 28, 2019 · 1 comment · Fixed by #78876
Closed

Bulk REST API allows arbitrary fields after action #43774

pickypg opened this issue Jun 28, 2019 · 1 comment · Fixed by #78876
Assignees
Labels
:Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >enhancement Team:Distributed Meta label for distributed team

Comments

@pickypg
Copy link
Member

pickypg commented Jun 28, 2019

While trying to refresh a specific index within a bulk request containing multiple indices, I came across an unexpected scenario where unrecognized field names were ignored:

POST /test/_bulk
{"index":{"_id":"1"}, "abc": true}
{"field":"value"}

In ES 7.2.0, at least, this results in the document being indexed.

However, if you put abc in front of the index action, then it triggers an expected error [from my perspective]:

POST /test/_bulk
{"abc": true, "index":{"_id":"1"}}
{"field":"value"}

results in

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_BOOLEAN]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Malformed action/metadata line [1], expected START_OBJECT or END_OBJECT but found [VALUE_BOOLEAN]"
  },
  "status": 400
}

We just need to update the parser to ensure that the JSON object is empty after finding the action. I can imagine that some people think some follow-on fields are taking effect as it is today.

@markharwood markharwood added :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >enhancement labels Jul 1, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@rjernst rjernst added the Team:Distributed Meta label for distributed team label May 4, 2020
@arteam arteam self-assigned this Sep 22, 2021
arteam added a commit that referenced this issue Nov 9, 2021
Make sure there are no arbitrary fields after an action declaration and that it gets properly closed by a curly bracket.

Resolves #43774
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. >enhancement Team:Distributed Meta label for distributed team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants