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

Fix: bulk response _source. #375

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

dblock
Copy link
Member

@dblock dblock commented Jul 3, 2024

Description

Two bugs fixed here.

  1. The value of _source is a document, so it is additionalProperties: true, not a set of objects.
    - { doc: { pages: 376 }, _source: true }
    - { update: { _index: books, _id: book_1392214 } }
    
  2. In a scripted_upsert a document may not be found, therefore not returning _source. There was an attempt to fix this in Made the InlineGet source field optional. #351, this PR replaces that one.
    - { update: { _index: books, _id: does_not_exist } }
    - { script: { source: 'ctx.op = "none";' }, scripted_upsert: true, upsert: { pages: 375 } }
    

Full response.

{
      "update": {
        "_index": "books",
        "_id": "book_1392214",
        "_version": 2,
        "result": "noop",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "_seq_no": 1,
        "_primary_term": 1,
        "get": {
          "_seq_no": 1,
          "_primary_term": 1,
          "found": true,
          "_source": {
            "author": "Harper Lee",
            "title": "To Kill a Mockingbird",
            "year": 1960,
            "pages": 376
          }
        },
        "status": 200
      }
    }

Without a _source.

{
      "update": {
        "_index": "books",
        "_id": "does_not_exist",
        "_version": -1,
        "result": "noop",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "get": {
          "found": false
        },
        "status": 200
      }
    }

Issues Resolved

Closes #350.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

github-actions bot commented Jul 3, 2024

Changes Analysis

Commit SHA: d249f30
Comparing To SHA: 25521f1

API Changes

Summary

└─┬Components
  ├─┬_common:InlineGet
  │ └──[➖] required (26575:11)❌ 
  └─┬_common:InlineGetDictUserDefined
    ├──[➖] required (26597:11)❌ 
    └─┬_source
      └──[🔀] additionalProperties (26592:33)❌ 

Document Element Total Changes Breaking Changes
components 3 3
  • BREAKING Changes: 3 out of 3
  • Modifications: 1
  • Removals: 2
  • Breaking Removals: 2
  • Breaking Modifications: 1

Report

The full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/9785125147/artifacts/1665784777

API Coverage

Before After Δ
Covered (%) 483 (47.31 %) 483 (47.31 %) 0 (0 %)
Uncovered (%) 538 (52.69 %) 538 (52.69 %) 0 (0 %)
Unknown 24 24 0

nhtruong
nhtruong previously approved these changes Jul 3, 2024
@nhtruong nhtruong merged commit a359a5a into opensearch-project:main Jul 4, 2024
8 checks passed
@dblock dblock deleted the fix-inline-get branch July 5, 2024 21:47
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

Successfully merging this pull request may close these issues.

[BUG] BulkRequest with scripted noop upsert UpdateOperation fails with "missing required property".
2 participants