Error while reindexing from 1.7 to 2.4


(Sylvain) #1

Hi there,

I'm migrating an elasticsearch instance from 1.7 to 2.4.
When trying to reindex my documents, after having upgraded my server, I got the following error:

curl -XPOST "$ES_IP:9200/_reindex?pretty" 2>/dev/null -H 'Content-Type: application/json' -d '{
      "source": {
        "index": "stats"
      },
      "dest": {
        "index": "stats_24"
      }
    }'
{
  "took" : 2528,
  "timed_out" : false,
  "total" : 13515,
  "updated" : 0,
  "created" : 0,
  "batches" : 1,
  "version_conflicts" : 0,
  "noops" : 0,
  "retries" : 0,
  "throttled_millis" : 0,
  "requests_per_second" : "unlimited",
  "throttled_until_millis" : 0,
  "failures" : [ {
    "index" : "stats_24",
    "type" : "account",
    "id" : "55ace2996661624cb9910100",
    "cause" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."
    },
    "status" : 400
  }, {
    "index" : "stats_24",
    "type" : "user",
    "id" : "55ace2946661624cb9860000",
    "cause" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."
    },
    "status" : 400
  }, {
    "index" : "stats_24",
    "type" : "machine",
    "id" : "55ace2a76661624cb9fa0400",
    "cause" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Cannot generate dynamic mappings of type [_id] for [_id]"
    },
    "status" : 400
  },
 ...

So I don't understand because there is no "_id" fields inside the source documents.

I saw in this thread that someone uses a script to changes its ids. So I've tried it, but it ends in:

"type" : "illegal_argument_exception",
"reason" : "script_lang not supported [painless]"

or, if I omit the "lang" part:

"type" : "script_exception",
"reason" : "scripts of type [inline], operation [update] and lang [groovy] are disabled"

Here's my elasticsearch.yml

http.host: 0.0.0.0
script.inline: true
script.stored: true
script.painless.regex.enabled: true
script.engine.groovy.inline.update: on
path.repo: /usr/share/elasticsearch

I really don't know where to go next ... :disappointed_relieved: Does anyone has any idea to solve this?


(Sylvain) #2

Ok, I finally found the solution.
My installation was based on docker-compose and, to validate my changes, I was running:

docker-compose restart

But this was not enough, my docker volume for the config directory, that I added afterwards, was not mounted.
I needed to run the following commands:

docker-compose stop elasticsearch
docker-compose rm -f elasticsearch
docker-compose up -d

Note that, even with that painless was not enabled but I used script described here to make my migration run.