title: Nested filter not working correctly in elasticsearch 1.7
body: <p>I cant make nested_filter sort work correctly.
  I have such mapping -</p>
  <pre><code>&quot;metadata&quot;: {
        &quot;type&quot;: &quot;nested&quot;,
        &quot;include_in_parent&quot;: true,
        &quot;properties&quot;: {
          &quot;property&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;index&quot; : &quot;not_analyzed&quot;,
            &quot;include_in_parent&quot; : false,
            &quot;include_in_all&quot; : false
          },
          &quot;type&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;index&quot;: &quot;not_analyzed&quot;
          },
          &quot;value&quot;: {
            &quot;type&quot;: &quot;string&quot;,
            &quot;fields&quot;: {
              &quot;lower_case_sort&quot;: {
                &quot;type&quot;: &quot;string&quot;,
                &quot;analyzer&quot;: &quot;case_insensitive_sort&quot;
              }
            }
          }
        }
      },
  </code></pre>
  <p>So each file has metadata with property 'duration' and value has duration value for example 50.300.
  Here I have the query that I am making but it is not returning the results either ascending or descending, it's random.</p>
  <pre><code>  &quot;query&quot;: {
      &quot;bool&quot;: {
        &quot;must&quot;: {
            &quot;term&quot; : {
                  &quot;parent.raw&quot;: &quot;folderName&quot;
             }
        }
      }
    },
    &quot;size&quot;: 50,
    &quot;from&quot;: 0,
    &quot;sort&quot;: {
          &quot;metadata.value&quot;: {
              &quot;order&quot;:&quot;desc&quot;,
              &quot;nested_filter&quot;: {
                  &quot;term&quot;: { &quot;metadata.property&quot;:&quot;duration&quot; }
              }
          }
      }
  }
  
  What could be the issue?
  
  Thank you!
  </code></pre>