# Copy\_to properties isn't queriable

**URL:** <https://discuss.elastic.co/t/copy-to-properties-isnt-queriable/231876>\
**Category:** Elasticsearch\
**Created:** [May 10, 2020, 8:10am UTC](https://discuss.elastic.co/t/copy-to-properties-isnt-queriable/231876 "2020-05-10T08:10:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![emarthinsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emarthinsen/32/23172_2.png) [@emarthinsen](https://discuss.elastic.co/u/emarthinsen)\
**Post date:** [May 10, 2020, 8:10am UTC](https://discuss.elastic.co/t/copy-to-properties-isnt-queriable/231876/1 "2020-05-10T08:10:25Z")

</div>

Hi. I've got a puzzling question here. This is the definition for my index:

```auto
"mappings": {
    "properties": {
        "name_copy": {
            "type": "text"
        },
        "name": {
            "type": "text",
            "copy_to": "name_copy"
        }
    }
}

```

I've simplified that definition a little bit to highlight just the fields I'm testing.

If I populate my index and run the following search against it, I get 158 hits:

```auto
{
    "query": {
        "match" : {
            "name" : "organic"
        }
    }
}

```

The following query returns zero hits:

```auto
{
    "query": {
        "match" : {
            "name_copy" : "organic"
        }
    }
}

```

Those two queries should be identical, correct? The field `name_copy` should just have the text that is in `name` in it. So, querying one should be the same as querying the other.

What am I doing wrong? How would you go about troubleshooting this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 10, 2020, 1:54pm UTC](https://discuss.elastic.co/t/copy-to-properties-isnt-queriable/231876/2 "2020-05-10T13:54:54Z")

</div>

I did not check the example you just sent but I guess it gives the correct results.  
So I'd then check the actual mapping, the analyzers...

If you could provide a script which does not match, that'd help to troubleshoot this.

---

<div class="post-metadata">

**Author:** ![emarthinsen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emarthinsen/32/23172_2.png) [@emarthinsen](https://discuss.elastic.co/u/emarthinsen)\
**Post date:** [May 11, 2020, 10:22pm UTC](https://discuss.elastic.co/t/copy-to-properties-isnt-queriable/231876/3 "2020-05-11T22:22:09Z")

</div>

Yeah, the `copy_to` was a red herring. Ultimately the issue was that in my mapping, I had a complex datatype errantly marked as `nested` instead of `object`.

Thanks for taking a look at it!

---

<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:** [June 8, 2020, 10:22pm UTC](https://discuss.elastic.co/t/copy-to-properties-isnt-queriable/231876/4 "2020-06-08T22:22:09Z")

</div>

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