If Field Mapping Exists

I'm in the middle of updating some mappings to an existing index and curious if there is a way to search to see if a specific field mapping exists?

For example, I update the mapping with the query below but now want to see which documents have name.lower field mapping after I update the index.:

PUT soure/_mapping/doc
{
  "properties": {
    "name": {
      "type": "text",
      "fields": {
        "complete": {
          "type": "completion",
          "analyzer": "simple",
          "preserve_separators": true,
          "preserve_position_increments": true,
          "max_input_length": 50
        },
        "not_analyzed": {
          "type": "keyword"
        },
        "raw": {
          "type": "text"
        },
        "lower": {
          "type": "text",
          "analyzer": "lowercase"
        }
      }
    }
  }
}

What do you want to be the result of such search?

@Igor_Motov I'd be looking for something similar to the exists query, where instead of say if field exists I could do field.mapping exits. This way I could do a count of "with mapping" and "without mapping".

Not sure I follow. exists works on the record level, but mapping is an index-level concept. Do you mean excluding all results from an index where this field is not mapped? Wouldn't it be easier to just look at the mapping and exclude the index with missing field in the mapping to start with?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.