Multi-fields and dynamic mapping

I'm getting started with ES and wrote a small test that indexes a few example documents.
Some of my documents have fields which have several types (e.g. long and text). Before I go ahead and change the documents themselves, I want to understand if I can index it as multi-fields (I don't have an explicit mapping so using the dynamic mapping).

My document for example looks like this:

  "event-name": "metadata-property-updated",
  "name": "name 1",
  "type": "file",
  "updated-attributes": {
    "other": [
        "attribute-name": "name",
        "attribute-type": "string",
        "new-value": "new name",
        "old-value": "old name"
        "attribute-name": "count",
        "attribute-type": "integer",
        "old-value": 3,
        "new-value": 4

And I'm getting the error:

java.lang.IllegalArgumentException: mapper [] of different type, current_type [long], merged_type [text]

You can't do that.

Thank you for the quick response!
Can I do that if I define full static mapping of my index? Or I must change my documents?

You must change your documents.

Field can't be both a String and a Number.

Got it. Thanks.

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