0
votes

Okay, here is the task:

I've already read the whole documentation and I noticed that I can "upgrade" a data type like string to a multi field - in a test scenario it already worked.

My documents structure is currently:

{
    "name": "test",
    "words": [
        {
            "words": "hello world",
            "verts": [
                1,
                2,
                3
            ]
        }
    ]
}

These documents were created using the default mappings - so no mapping has been set explicitly.

I am issuing a XDELETE command with data like:

{
    "article": {
        "properties": {
            "words": {
                "type": "multi_field",
                "fields": {
                    "words": {
                        "type": "string",
                        "index": "analyzed"
                    },
                    "untouched": {
                        "type": "string",
                        "index": "not_analyzed"
                    }
                }
            }
        }
    }
}

But I receive this error here:

{"error":"MergeMappingException[Merge failed with failures {[Can't merge a non multi_field / non simple mapping [words] with a multi_field mapping [words]]}]","status":400}

Can someone explain to me, why this happens? When I issue this mapping to a clean index, it works and the not_analyzed filter is being applied.

Thanks :)

Jan

1

1 Answers

1
votes

Because the "words" field in your document has properties of its own ("words" and "verts"), you can't "upgrade" it to a multi_field. However, if you had a mapping like

{
"article": {
    "properties": {
        "words": {
            "properties": {
                "words": {
                    "type": "multi_field",
                    "fields": {
                        "words": {
                            "type": "string",
                            "index": "analyzed"
                        },
                        "untouched": {
                            "type": "string",
                            "index": "not_analyzed"
                        }
                    }
                }
            }
        }
    }
}
}

then everything should work out.