Link Search Menu Expand Document Documentation Menu

You're viewing version 2.16 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.

Ignored

The _ignored field helps you manage issues related to malformed data in your documents. This field is used to index and store field names that were ignored during the indexing process as a result of the ignore_malformed setting being enabled in the index mapping.

The _ignored field allows you to search for and identify documents containing fields that were ignored as well as for the specific field names that were ignored. This can be useful for troubleshooting.

You can query the _ignored field using the term, terms, and exists queries, and the results will be included in the search hits.

The _ignored field is only populated when the ignore_malformed setting is enabled in your index mapping. If ignore_malformed is set to false (the default value), then malformed fields will cause the entire document to be rejected, and the _ignored field will not be populated.

The following example request shows you how to use the _ignored field:

GET _search
{
  "query": {
    "exists": {
      "field": "_ignored"
    }
  }
}


Example indexing request with the _ignored field

The following example request adds a new document to the test-ignored index with ignore_malformed set to true so that no error is thrown during indexing:

PUT test-ignored
{
  "mappings": {
    "properties": {
      "title": {
        "type": "text"
      },
      "length": {
        "type": "long",
        "ignore_malformed": true
      }
    }
  }
}

POST test-ignored/_doc
{
  "title": "correct text",
  "length": "not a number"
}

GET test-ignored/_search
{
  "query": {
    "exists": {
      "field": "_ignored"
    }
  }
}

Example reponse

{
  "took": 42,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "test-ignored",
        "_id": "qcf0wZABpEYH7Rw9OT7F",
        "_score": 1,
        "_ignored": [
          "length"
        ],
        "_source": {
          "title": "correct text",
          "length": "not a number"
        }
      }
    ]
  }
}

Ignoring a specified field

You can use a term query to find documents in which a specific field was ignored, as shown in the following example request:

GET _search
{
  "query": {
    "term": {
      "_ignored": "created_at"
    }
  }
}

Reponse

{
  "took": 51,
  "timed_out": false,
  "_shards": {
    "total": 45,
    "successful": 45,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 0,
      "relation": "eq"
    },
    "max_score": null,
    "hits": []
  }
}
350 characters left

Have a question? .

Want to contribute? or .