2

After upgrading from ES 5 to ES 6 I've got error message each time i want to store something in new index. However all old indexes are working fine.

The error message is:

Rejecting mapping update to [test] as the final mapping would have more than 1 type: [user, group]

Im using elasticsearch 6.3. It works properly on production server on previously created indexes. I've tried dropping index to no avail.

My test documents are:

PUT test/group/1
{
    "id": "5b29fb9aa3d24b5a2b6b8fcb",
    "_mongo_id_": "5b29fb9aa3d24b5a2b6b8fcb"
}

and

PUT test/user/1
{
  "id": "5ad4800ca3d24be81d7a6806",
  "_mongo_id_": "5ad4800ca3d24be81d7a6806"
}

Index mapping seems ok:

{
  "mapping": {
    "group": {
      "properties": {
        "_mongo_id_": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
  }
}
PeterM
  • 1,478
  • 1
  • 22
  • 28
  • Possible duplicate of [Can't create two Types to same index elasticsearch & Kibana](https://stackoverflow.com/questions/47632846/cant-create-two-types-to-same-index-elasticsearch-kibana) – Cavaz Aug 07 '18 at 13:17

1 Answers1

3

You're trying to add more than one type per index

PUT test/group/1

PUT test/user/1

This behaviour is not allowed from ES 6.

From breaking changes

The ability to have multiple mapping types per index has been removed in 6.0. New indices will be restricted to a single type. This is the first step in the plan to remove mapping types altogether. Indices created in 5.x will continue to support multiple mapping types.

jordivador
  • 1,016
  • 11
  • 26
  • 3
    So now I understand why it worked until I re-created index. The elasticsearch is so elastic that it's hard to hold it! – PeterM Jun 20 '18 at 11:24