xuelai
xuelai

Reputation: 65

Elasticsearch copy_to field type

I wonder that if the type of destination field of copy_to must be text type. I have not find the description in the official document. https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html

In other words,can the full_name's type be other type but not text? Thanks.

PUT my-index-000001
{
  "mappings": {
    "properties": {
      "first_name": {
        "type": "text",
        "copy_to": "full_name" 
      },
      "last_name": {
        "type": "text",
        "copy_to": "full_name" 
      },
      "full_name": {
        "type": "text"
      }
    }
  }
}

Upvotes: 1

Views: 864

Answers (1)

Amit
Amit

Reputation: 32376

You can try it yourself, I tried it creating with keyword and integer types and it worked perfectly fine.

However if you define it to be integer and then try to index text like the one given in example it will throw mapper_parsing_exception.

Upvotes: 1

Related Questions