<p dir="auto">Hello,</p>
<p dir="auto">I have a mapping like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="curl -XPUT 'http://localhost:9200/onesite/drupal/_mapping' -d '
{
  &quot;drupal&quot; : {
    &quot;properties&quot; : {
     &quot;id&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true, copy_to: &quot;url&quot; },
     &quot;title&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true },
     &quot;type&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true },
     &quot;changed&quot; : {&quot;type&quot; : &quot;date&quot;, &quot;format&quot; : &quot;YYYY-MM-dd&quot;, &quot;store&quot; : true, copy_to : &quot;date&quot; },
     &quot;date&quot; : {&quot;type&quot;: &quot;string&quot;},
     &quot;url&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true },
     &quot;topic&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true },
     &quot;lang&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true },
     &quot;path_alias&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true },
     &quot;language&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true ,&quot;copy_to&quot; : &quot;lang&quot;},
     &quot;body&quot;: {
        &quot;type&quot;: &quot;nested&quot;,
        &quot;properties&quot;: {
           &quot;und&quot;: {
              &quot;type&quot;: &quot;nested&quot;,
              &quot;properties&quot;: {
                 &quot;format&quot;: {&quot;type&quot;: &quot;string&quot;},
                 &quot;safe_value&quot;: {&quot;type&quot;: &quot;string&quot;},
                 &quot;value&quot;: {&quot;type&quot;: &quot;string&quot;, &quot;copy_to&quot;: &quot;content&quot;}
              }
            }
        }
       },
       &quot;field_intro&quot;: {
          &quot;type&quot;: &quot;nested&quot;,
          &quot;properties&quot;: {
             &quot;und&quot;: {
                &quot;type&quot;: &quot;nested&quot;,
                &quot;properties&quot;: {
                   &quot;format&quot;: {&quot;type&quot;: &quot;string&quot;},
                   &quot;safe_value&quot;: {&quot;type&quot;: &quot;string&quot;},
                   &quot;value&quot;: {&quot;type&quot;: &quot;string&quot;}
                }
             }
           }
        },
        &quot;content&quot; : {&quot;type&quot; : &quot;string&quot;, &quot;store&quot; : true, index: &quot;analyzed&quot; }
    }
 }
}'"><pre class="notranslate"><code class="notranslate">curl -XPUT 'http://localhost:9200/onesite/drupal/_mapping' -d '
{
  "drupal" : {
    "properties" : {
     "id" : {"type" : "string", "store" : true, copy_to: "url" },
     "title" : {"type" : "string", "store" : true },
     "type" : {"type" : "string", "store" : true },
     "changed" : {"type" : "date", "format" : "YYYY-MM-dd", "store" : true, copy_to : "date" },
     "date" : {"type": "string"},
     "url" : {"type" : "string", "store" : true },
     "topic" : {"type" : "string", "store" : true },
     "lang" : {"type" : "string", "store" : true },
     "path_alias" : {"type" : "string", "store" : true },
     "language" : {"type" : "string", "store" : true ,"copy_to" : "lang"},
     "body": {
        "type": "nested",
        "properties": {
           "und": {
              "type": "nested",
              "properties": {
                 "format": {"type": "string"},
                 "safe_value": {"type": "string"},
                 "value": {"type": "string", "copy_to": "content"}
              }
            }
        }
       },
       "field_intro": {
          "type": "nested",
          "properties": {
             "und": {
                "type": "nested",
                "properties": {
                   "format": {"type": "string"},
                   "safe_value": {"type": "string"},
                   "value": {"type": "string"}
                }
             }
           }
        },
        "content" : {"type" : "string", "store" : true, index: "analyzed" }
    }
 }
}'
</code></pre></div>
<p dir="auto">As you can see, I'm trying to get the value of "body.und.value" into "content".</p>
<p dir="auto">I can query body.und.value but I cannot query on "content".</p>
<p dir="auto">Can someone help in identifying what I'm doing wrong?</p>
<p dir="auto">I'm using Elasticsearch 1.1.2</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="curl -XGET localhost:9200
{
  &quot;status&quot; : 200,
  &quot;name&quot; : &quot;Eric Williams&quot;,
  &quot;version&quot; : {
    &quot;number&quot; : &quot;1.1.2&quot;,
    &quot;build_hash&quot; : &quot;e511f7b28b77c4d99175905fac65bffbf4c80cf7&quot;,
    &quot;build_timestamp&quot; : &quot;2014-05-22T12:27:39Z&quot;,
    &quot;build_snapshot&quot; : false,
    &quot;lucene_version&quot; : &quot;4.7&quot;
  },
  &quot;tagline&quot; : &quot;You Know, for Search&quot;
}
"><pre class="notranslate"><code class="notranslate">curl -XGET localhost:9200
{
  "status" : 200,
  "name" : "Eric Williams",
  "version" : {
    "number" : "1.1.2",
    "build_hash" : "e511f7b28b77c4d99175905fac65bffbf4c80cf7",
    "build_timestamp" : "2014-05-22T12:27:39Z",
    "build_snapshot" : false,
    "lucene_version" : "4.7"
  },
  "tagline" : "You Know, for Search"
}

</code></pre></div>
<p dir="auto">I have a nested field, containing some fields with the 'copy_to' attribute. I index a document. Then, I look at the mappings - these show the 'copy_to' field as appearing in the root object, not the nested objects.</p>
<p dir="auto">(See <a href="https://gist.github.com/tstibbs/dc36483f96f8d1471385">https://gist.github.com/tstibbs/dc36483f96f8d1471385</a> for the necessary commands to reproduce.)</p>
<p dir="auto">However, the fields appear to be copied into the 'copy_to' field in the nested object.</p>
<p dir="auto">If the 'copied' field is created in the root object, the following query should return my document (but it doesn't):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;query&quot;: {
    &quot;bool&quot;: {
      &quot;must&quot;: [
        {
          &quot;match&quot; : {
            &quot;copied&quot; : &quot;rover&quot;
          }
        },
        {
          &quot;nested&quot;: {
            &quot;path&quot;: &quot;children&quot;,
            &quot;score_mode&quot;: &quot;avg&quot;,
            &quot;query&quot;: {
              &quot;match&quot;: {
                &quot;colour&quot;: &quot;red&quot;
              }
            }
          }
        }
      ]
    }
  }
}"><pre class="notranslate"><code class="notranslate">{
  "query": {
    "bool": {
      "must": [
        {
          "match" : {
            "copied" : "rover"
          }
        },
        {
          "nested": {
            "path": "children",
            "score_mode": "avg",
            "query": {
              "match": {
                "colour": "red"
              }
            }
          }
        }
      ]
    }
  }
}
</code></pre></div>
<p dir="auto">If the 'copied' field is created in each child, then following query should match (it does):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{
  &quot;query&quot;: {
    &quot;nested&quot;: {
      &quot;path&quot;: &quot;children&quot;,
      &quot;score_mode&quot;: &quot;avg&quot;,
      &quot;query&quot;: {
        &quot;bool&quot;: {
          &quot;must&quot;: [
            {
              &quot;match&quot;: {
                &quot;copied&quot;: &quot;rover&quot;
              }
            },
            {
              &quot;match&quot;: {
                &quot;colour&quot;: &quot;red&quot;
              }
            }
          ]
        }
      }
    }
  }
}"><pre class="notranslate"><code class="notranslate">{
  "query": {
    "nested": {
      "path": "children",
      "score_mode": "avg",
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "copied": "rover"
              }
            },
            {
              "match": {
                "colour": "red"
              }
            }
          ]
        }
      }
    }
  }
}
</code></pre></div>
<p dir="auto">To me, the current behaviour makes sense - the fields are copied to a field within the item itself. However, I think the issue is that the mapping doesn't match the behaviour, and the documentation doesn't specify which is correct.</p>
<p dir="auto">So, I can't currently use this feature, because I don't know which issue is the bug!</p>