# Copy\_to field not searchable as I would expect

**URL:** <https://discuss.elastic.co/t/copy-to-field-not-searchable-as-i-would-expect/278727>\
**Category:** Elasticsearch\
**Created:** [July 14, 2021, 11:20pm UTC](https://discuss.elastic.co/t/copy-to-field-not-searchable-as-i-would-expect/278727 "2021-07-14T23:20:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tasslehawf](https://avatars.discourse-cdn.com/v4/letter/t/e19b73/32.png) [@tasslehawf](https://discuss.elastic.co/u/tasslehawf)\
**Post date:** [July 14, 2021, 11:20pm UTC](https://discuss.elastic.co/t/copy-to-field-not-searchable-as-i-would-expect/278727/1 "2021-07-14T23:20:33Z")

</div>

Here is my index:

```auto
{
  "settings": {
    "analysis": {
      "normalizer": {
        "keyword_lowercase": {
          "type": "custom",
          "filter": [
            "lowercase",
            "asciifolding"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "author_pub_fqdn": {
        "type": "keyword",
        "store": true
      },
      "author_string": {
        "type": "text",
        "store": true,
        "copy_to": "author_pub_fqdn",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256,
            "normalizer": "keyword_lowercase"
          }
        }
      },
      "collection": {
        "type": "long"
      },
      "collection_id": {
        "type": "long"
      },
      "processed": {
        "type": "boolean"
      },
      "publication_fqdn": {
        "type": "keyword",
        "copy_to": "author_pub_fqdn"
      },
      "use_in_article_search": {
        "type": "boolean"
      }
    }
  }
}

```

I have migrated a sample set of data from the old index. Here is a doc example:

```auto
{ - 
        "_index": "testing_v3",
        "_type": "_doc",
        "_id": "查看pdf原文finance.sina.com.cn544205",
        "_score": 1.5472039,
        "_source": { - 
          "collection_id": 544205,
          "author_string": "查看PDF原文",
          "publication_fqdn": "finance.sina.com.cn",
          "use_in_article_search": true
        }
      },

```

I want the copy\_to on author\_string and publication\_fqdn so I can query them at the same time. I followed the example in the documentation. My copy\_to field is author\_pub\_fqdn.

According to the docs, I should be able to query this doc using this query:

```auto
{
  "query": {
    "match": {
      "author_pub_fqdn": { 
        "query": "查看PDF原文 finance.sina.com.cn",
        "operator": "and"
      }
    }
  }
}

```

But I don't get any results.

I do get results if I query the author\_pub\_fqdn field for either the author\_string or the publication\_fqdn.

```auto
{
  "query": {
    "match": {
      "author_pub_fqdn": { 
        "query": "finance.sina.com.cn",
        "operator": "and"
      }
    }
  }
}

```

```auto
{
  "query": {
    "match": {
      "author_pub_fqdn": { 
        "query": "查看PDF原文",
        "operator": "and"
      }
    }
  }
}

```

Both of these find the doc so I know there must be data in the author\_pub\_fqdn field. I also tried making at the fields the same type (keyword), but still got the same results.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 15, 2021, 6:16am UTC](https://discuss.elastic.co/t/copy-to-field-not-searchable-as-i-would-expect/278727/2 "2021-07-15T06:16:37Z")

</div>

What happens if you make the copy\_to field a text field?

---

<div class="post-metadata">

**Author:** ![tasslehawf](https://avatars.discourse-cdn.com/v4/letter/t/e19b73/32.png) [@tasslehawf](https://discuss.elastic.co/u/tasslehawf)\
**Post date:** [July 16, 2021, 3:59pm UTC](https://discuss.elastic.co/t/copy-to-field-not-searchable-as-i-would-expect/278727/3 "2021-07-16T15:59:33Z")

</div>

That works! Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 13, 2021, 4:00pm UTC](https://discuss.elastic.co/t/copy-to-field-not-searchable-as-i-would-expect/278727/4 "2021-08-13T16:00:32Z")

</div>

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