Setting a default value for missing fields during indexing

(michele crudele) #1

I would like to set in my mappings file a default value for all fields of a given type that are missing in the doc while indexing. I mean something like:

    "mappings": {
        "defaults_by_type": {
            "string": "NA",
           "long": NaN,
          "double": NaN,
          "date": "1970-01-01"
        "my_type": {
         "properties": {...}

that means literally: when any of the string fields in the source doc does not have a value, then use the string "NA", and similarly for the other types.
Is that actually available? If not, how can I achieve the same results?

(Mark Walkom) #2 should do what you want.

(system) #3