0
votes

I have an existing index named "Docs" which has documents in it. I am creating a new Index named "Docs1" exactly same like "Docs" with only one extra field with analyzer in one property, which I want to use for autocomplete purpose.

Property in "Docs" index

"name": {

     "type": "text",

     "analyzer": "text_standard_analyzer",

     "fields": {

       "keyword": {

         "type": "keyword",

         "ignore_above": 256

       }

     }

   }

Property in the "Docs1" index going to be

{
  "name": {
    "type": "text",
    "analyzer": "text_standard_analyzer",
    "fields": {
      "keyword": {
        "type": "keyword",
        "ignore_above": 256
      },
      "pmatch": {
        "type": "text",
        "analyzer": "text_partialmatching_analyzer"
      }
    }
  }
}

I am using Reindex API to copy records from "Docs" to "Docs1"

POST _reindex { "source": { "index": "Docs" }, "dest": { "index": "Docs1" } }

when I reindex, I expect for the older documents to contain the new field with the information in that field.

I am noticing the new field in my destination index "Docs1" is not analyzed for existing data. But it is analyzed for any new documents I am adding.

Please suggest

1
Looking at the mappings and reindex command, how do you expect elasticsearch to know what data to put in the new field? You need to create a multi-field or use a "copy_to" in your mapping.Archit Saxena
I am already using multi-fields.In my "Docs1" index definition, I have "name" property with 2 fields "keyword" and "pmatch". I want to analyze the same field in different ways.Lucky
oh right, i got confused because of the formatting. Did you check the logs for some errors?Archit Saxena
Reindex by adding "type" workedLucky
POST _reindex { "source": { "index": "sourceindex" }, "dest": { "index": "destindex", "type":"desttype" } }Lucky

1 Answers

0
votes

Reindex by adding "type" worked

POST _reindex { "source": { "index": "sourceindex" }, "dest": { "index": "destindex", "type":"desttype" } }