Re-indexing into schema with new multifields

Hi,

Let's say, for the sake of simplicity, I have an index "a" with only this field in the schema:

 "foo": {
                "type": "keyword",
              }

And then I create a new index "b" with a new multifield added to the schema because I want to be able to tokenize on the same field and run free text queries against it:

 "foo": {
                "type": "keyword",
                "fields" : {
                  "search": {
                    "type": "text",
                    "analyzer" : "standard"
                  }
                }
              }

If I then do a simple re-index as follows:

POST _reindex
{
  "source": {
    "index": "a"
  },
  "dest": {
    "index": "b"
  }
}

Will index "b" have "foo.search" populated with the analyzed tokens by default? The reason I ask is because on the one hand I would expect it to. But then I see this in the docs for the "reindex" API:

The most basic form of _reindex just copies documents from one index to another. This will copy documents from the twitter index into the new_twitter index

"copy" sounds like "b" will have the exact same thing as "a" had prior to the operation, without adding anything new to the "search" multifield in this case.

From my observations on my data after re-indexing, it looks like "b" doesn't have the new analyzed tokens for the "foo.search" field apart from subsequently indexing a document explicitly against the "b" index (e.g. via a call to POST /b/_doc/).

What is the expected/designed Elasticsearch behavior?

"The most basic form" implies that you aren't doing any mapping changes. Given you have a new mapping defined with extra fields, the index process will respect that and populate those fields for you.

Thank you for confirming.

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