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 update child doc, NPE error message when parent is not specified #8365

Closed
bly2k opened this issue Nov 6, 2014 · 1 comment
Closed
Assignees
Labels
>bug good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories

Comments

@bly2k
Copy link
Contributor

bly2k commented Nov 6, 2014

If you do a _bulk that contains an update to a child doc (parent/child) and you don't (or forget to) specify the parent id, you will get an NPE error message in the item response. It would be good to adjust the error message to RoutingMissingException (just like when you do a single update (not _bulk) to the same doc but forget to specify parent id.

Steps to reproduce:

curl -XDELETE localhost:9200/test1

curl -XPUT localhost:9200/test1 -d '{
  "mappings": {
    "p": {},
    "c": {
      "_parent": {
        "type": "p"
      }
    }
  }
}'

curl -XPUT localhost:9200/test1/c/1?parent=1 -d '{
}'

curl -XPOST localhost:9200/test1/c/_bulk -d '
{ "update": { "_id": "1" }}
{ "doc": { "foo": "bar" } }
'

Response:

{"error":"NullPointerException[null]","status":500}
wwken added a commit to wwken/elasticsearch that referenced this issue Nov 7, 2014
…ecified elastic#8365

  - Throw an RoutingMissingException instead of NPE
@wwken
Copy link
Contributor

wwken commented Nov 7, 2014

This is fixed in: #8378

@clintongormley clintongormley added the good first issue low hanging fruit label Nov 14, 2014
@markharwood markharwood self-assigned this Nov 17, 2014
@markharwood markharwood removed the help wanted adoptme label Nov 17, 2014
markharwood pushed a commit that referenced this issue Nov 17, 2014
…ecified #8365

  - Throw an RoutingMissingException instead of NPE
markharwood pushed a commit that referenced this issue Nov 17, 2014
…ecified #8365

  - Throw an RoutingMissingException instead of NPE
markharwood added a commit that referenced this issue Nov 17, 2014
…ion.

Now each error is reported in bulk response rather than causing entire bulk to fail.
Added a Junit test but the use of TransportClient means the error is manifested differently to a REST based request - instead of a NullPointer the whole of the bulk request failed with a RoutingMissingException. Changed TransportBulkAction to catch this exception and treat it the same as the existing logic for a ElasticsearchParseException - the individual bulk request items are flagged and reported individually rather than failing the whole bulk request.

Closes #8365
markharwood pushed a commit that referenced this issue Nov 17, 2014
…ecified #8365

  - Throw an RoutingMissingException instead of NPE
markharwood added a commit that referenced this issue Nov 17, 2014
…ion.

Now each error is reported in bulk response rather than causing entire bulk to fail.
Added a Junit test but the use of TransportClient means the error is manifested differently to a REST based request - instead of a NullPointer the whole of the bulk request failed with a RoutingMissingException. Changed TransportBulkAction to catch this exception and treat it the same as the existing logic for a ElasticsearchParseException - the individual bulk request items are flagged and reported individually rather than failing the whole bulk request.

Closes #8365
markharwood pushed a commit that referenced this issue Nov 21, 2014
…ecified #8365

  - Throw an RoutingMissingException instead of NPE
markharwood added a commit that referenced this issue Nov 21, 2014
…ion.

Now each error is reported in bulk response rather than causing entire bulk to fail.
Added a Junit test but the use of TransportClient means the error is manifested differently to a REST based request - instead of a NullPointer the whole of the bulk request failed with a RoutingMissingException. Changed TransportBulkAction to catch this exception and treat it the same as the existing logic for a ElasticsearchParseException - the individual bulk request items are flagged and reported individually rather than failing the whole bulk request.

Closes #8365
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…ecified elastic#8365

  - Throw an RoutingMissingException instead of NPE
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…ion.

Now each error is reported in bulk response rather than causing entire bulk to fail.
Added a Junit test but the use of TransportClient means the error is manifested differently to a REST based request - instead of a NullPointer the whole of the bulk request failed with a RoutingMissingException. Changed TransportBulkAction to catch this exception and treat it the same as the existing logic for a ElasticsearchParseException - the individual bulk request items are flagged and reported individually rather than failing the whole bulk request.

Closes elastic#8365
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…ecified elastic#8365

  - Throw an RoutingMissingException instead of NPE
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
…ion.

Now each error is reported in bulk response rather than causing entire bulk to fail.
Added a Junit test but the use of TransportClient means the error is manifested differently to a REST based request - instead of a NullPointer the whole of the bulk request failed with a RoutingMissingException. Changed TransportBulkAction to catch this exception and treat it the same as the existing logic for a ElasticsearchParseException - the individual bulk request items are flagged and reported individually rather than failing the whole bulk request.

Closes elastic#8365
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Parent/Child labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
4 participants