Query to list all _ignored field values

I am running ES version 7.10. What is the query to get all docs where _ignored field exists and lists the value?

Hi @Alex_Raguero

This doc help you: _ignored field | Elasticsearch Guide [8.13] | Elastic

Hi, I wasn't sure what to put as my source so it returns the _ignored value:

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

You need to run a query to get all the documents where the _ignored field exists.

For example, the following query will query your indices and return the documents where the _ignored field exists.

GET */_search
{
  "query": {
    "exists": {
      "field": "_ignored"
    }
  },
  "_source": false
}

You will get something like this as an answer:

{
  "took": 4,
  "timed_out": false,
  "_shards": {
    "total": 4,
    "successful": 4,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "index-name",
        "_id": "document-id",
        "_score": 1,
        "_ignored": [
          "field.name"
        ]
      }
    ]
  }
}

The field.name is the name of the field that was ignored during indexing, to get its value you would need to return the entire document or filter the return by this field, but since you may not always no the name of the field being ignored you may need to return the entire document.

To return the entire document just use this:

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

To filter by the ignored field just use:

{
  "query": {
    "exists": {
      "field": "_ignored"
    }
  },
  "fields": [
    "field.name"
  ],
  "_source": false
}

Thank you!