Skip to content

[BUG] Field-level ignore_malformed should override index-level setting #16599

Open
@andrross

Description

@andrross

Describe the bug

The ignore_malformed property can be set at the index level and at the individual field level. I believe the field-level setting should override the index-level setting if both are present, but that is not the observed behavior for OpenSearch 2.4 and later.

Related component

Indexing

To Reproduce

Create an index like the following:

curl -X PUT -u admin:$PWD --insecure "https://localhost:9200/my-index-000001?pretty" -H 'Content-Type: application/json' -d'
{
  "settings": {
    "index.mapping.ignore_malformed": true
  },
  "mappings": {
    "properties": {
      "number_one": {
        "type": "byte"
      },
      "number_two": {
        "type": "integer",
        "ignore_malformed": false
      }
    }
  }
}
'

Index a document with a malformed value for the number_two field:

curl -X PUT -u admin:$PWD --insecure "https://localhost:9200/my-index-000001/_doc/2?pretty" -H 'Content-Type: application/json' -d'
{
  "text":       "Some text value",
  "number_two": "foo"
}
'

This succeeds, but it should fail because the ignore_malformed value has been set to false for that field.

Expected behavior

Field-level setting should override index-level setting.

Additional Details

This behaved as expected for versions of OpenSearch prior to 2.4.

Slack thread where originally reported: https://opensearch.slack.com/archives/C0539F41Z5X/p1730959987164549

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingIndexing, Bulk Indexing and anything related to indexingbugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions