Dynamic template with copy_to completion suggester throws error on null value

We're testing out completion suggester behavior with a dynamic template and found a problem indexing documents with a null value. After a document with a non-null value is indexed, a second document with a null value results in the following error (Elasticsearch version 2.3.5):

"type": "mapper_parsing_exception",
"reason": "completion field [auto_suggest] does not support null values"

We tried using null_value to replace the null with "" or similar, but it didn't help. Are we doing something wrong with our configuration, or is there another workaround? We might receive nulls anywhere in our documents and would prefer to avoid pre-processing documents outside of ES (though that's an option if we can't get this resolved).

We also have ES instances with 1x that throw a similar but different error. Any options to fix this issue are appreciated, and please let me know if additional information would help.

Dynamic template:

{
"mappings": {
    "_default_": {
        "dynamic_templates": [
            {
                "string_suggest": {
                    "mapping": {
                        "copy_to": [
                            "auto_suggest"
                        ],
                        "type": "string"
                    },
                    "match_mapping_type": "string"
                }
            }
        ],
        "properties": {
            "auto_suggest": {
            	"type": "completion"
            }
        }
    }
},
"template": "*"
}

First document:

{
"some_field": "test"
}

Second document that triggers the error:

{
"some_field": null
}

bump since we have not figured out a workaround :frowning:

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