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

[BUG] Bulk API doesn't honor the default_pipeline and final_pipeline defined in index template when auto-create index happens #12888

Closed
gaobinlong opened this issue Mar 25, 2024 · 2 comments
Labels
bug Something isn't working ingest-pipeline v2.16.0 Issues and PRs related to version 2.16.0 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@gaobinlong
Copy link
Collaborator

Describe the bug

Update action with upsert in bulk API doesn't honor the default_pipeline and final_pipeline defined in an index template when the auto-created index matches with the template, this should be a bug because if the specified index already exists, the default_pipeline and final_pipeline will be executed.

Related component

Indexing

To Reproduce

  1. Create an index template
PUT _index_template/test_index_template
{
  "index_patterns": ["test*"],
  "template": {
    "settings": {
      "index": {
        "final_pipeline": "test_pipeline"
      }
    }
  }
}
  1. Create an ingest pipeline
PUT _ingest/pipeline/test_pipeline
{
  "processors": [
    {
      "set": {
        "field": "z",
        "value": 100
      }
    }]
}
  1. Bulk update with upsert
POST /_bulk
{"update":{"_index":"test1","_id":"1"}}
{"upsert":{"x":3,"y":5},"script":{"source":"ctx._source.x += 1"}}
  1. Check the result
GET test1/_doc/1
{
  "_index": "test1",
  "_id": "1",
  "_version": 1,
  "_seq_no": 0,
  "_primary_term": 1,
  "found": true,
  "_source": {
    "x": 3,
    "y": 5
  }
}

, we can see that the pipeline test_pipeline was not executed.

But if the index test1 already exists before bulk, the result is different:

  1. Delete the document 1
DELETE test1/_doc/1
  1. Bulk update with upsert
POST /_bulk
{"update":{"_index":"test1","_id":"1"}}
{"upsert":{"x":3,"y":5},"script":{"source":"ctx._source.x += 1"}}
  1. Check the result
GET test1/_doc/1
{
  "_index": "test1",
  "_id": "1",
  "_version": 1,
  "_seq_no": 2,
  "_primary_term": 1,
  "found": true,
  "_source": {
    "x": 3,
    "y": 5,
    "z": 100
  }
}

Expected behavior

When the auto-creation happens, the default_pipeline and final_pipeline should be resolved correctly and then be executed.

Additional Details

Host/Environment (please complete the following information):

  • OS: [MacOS]
  • Version [main branch]
@gaobinlong gaobinlong added bug Something isn't working untriaged labels Mar 25, 2024
@github-actions github-actions bot added the Indexing Indexing, Bulk Indexing and anything related to indexing label Mar 25, 2024
@vikasvb90 vikasvb90 added ingest-pipeline and removed Indexing Indexing, Bulk Indexing and anything related to indexing labels Mar 27, 2024
@peternied
Copy link
Member

[Triage - attendees 1 2 3 4 5 6 7]
@gaobinlong Thanks for the detailed issue and pull request.

@reta reta added v3.0.0 Issues and PRs related to version 3.0.0 v2.16.0 Issues and PRs related to version 2.16.0 labels Jul 16, 2024
@gaobinlong
Copy link
Collaborator Author

Closed by #12891.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ingest-pipeline v2.16.0 Issues and PRs related to version 2.16.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

No branches or pull requests

4 participants