Elasticsearch reindexing with new mapping and new fields


(mehmet) #1

Hi guys,
I am using elasticsearch 1.3.4 and I need to reindex my data with new mapping and new field

my current mapping like this:

{
  "book_v1": {
    "mappings": {
      "en": {
        "dynamic": "true",
        "numeric_detection": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "analyzer": "name_analyzer",
            "norms": {
              "enabled": false
            },
            "type": "string"
          }
        }
      }
    }
  }
}

and i want to create new mapping and reindex my data.

{
  "book_v2": {
    "mappings": {
      "en": {
        "dynamic": "true",
        "numeric_detection": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "name.ngram": {
            "analyzer": "ngram_analyzer",
            "norms": {
              "enabled": false
            },
            "type": "string"
          },
          "name.edgeGram": {
            "analyzer": "edgegram_analyzer",
            "norms": {
              "enabled": false
            },
            "type": "string"
          }
        }
      }
    }
  }
}

I'm looking for something like this. I look elasticsearch reindexing and it doesn't do what i want or i misuse it.
Because i create book_v2 and try to reindex data from book_v1 and it didn't work as i expected. i override my book_v2. and create duplicate of book_v1.
So, any idea how can do this?
(p.s: plugins not preferred. )


(Mark Walkom) #2

Easiest way is to create a new index with the new mapping and then reindex the data into it.
Aliases can help here


(system) #3