title: Check if array contains object with a certain field in Elastic Search?
body: <p>I am new to Elastic Search, and my data has the form:</p>
  <p>Index Mapping</p>
  <pre><code>{
      &quot;company:product:index&quot;: {
          &quot;aliases&quot;: {},
          &quot;mappings&quot;: {
              &quot;company:product:mapping&quot;: {
                  &quot;properties&quot;: {
                      &quot;attribute_heel-style&quot;: {
                          &quot;properties&quot;: {
                              &quot;label&quot;: {
                                  &quot;type&quot;: &quot;keyword&quot;
                              },
                              &quot;name&quot;: {
                                  &quot;type&quot;: &quot;keyword&quot;
                              },
                              &quot;source&quot;: {
                                  &quot;type&quot;: &quot;keyword&quot;
                              },
                              &quot;value&quot;: {
                                  &quot;type&quot;: &quot;keyword&quot;
                              },
                              &quot;value_label&quot;: {
                                  &quot;type&quot;: &quot;keyword&quot;
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  <p>Index Data</p>
  <pre><code>{
      &quot;attribute_heel-style&quot;: [
          {
              &quot;name&quot;: &quot;heel-style&quot;,
              &quot;label&quot;: &quot;Heel Style&quot;,
              &quot;value&quot;: &quot;stiletto&quot;,
              &quot;value_label&quot;: &quot;Stiletto&quot;
          },
          {
              &quot;name&quot;: &quot;heel-style&quot;,
              &quot;label&quot;: &quot;Heel Style&quot;,
              &quot;value&quot;: &quot;wedge&quot;
              &quot;value_label&quot;: &quot;Wedge&quot;
          },
          ... // a bunch of other objects in this array as well
      ]
  }
  </code></pre>
  <p>I'd like to create a query so that I can filter all objects within the array who have the value &quot;Wedge&quot; for the key &quot;value_label&quot;. How can I do this?</p>
  <p>Edit: Found the solution! Posting below. Thank you to @EsCoder.</p>
  <pre><code>{
      &quot;query&quot;: {
          &quot;bool&quot;: {
              &quot;filter&quot;: [
                  {
                      &quot;bool&quot;: {
                          &quot;must&quot;: [
                              {
                                  &quot;term&quot;: {
                                      &quot;attribute_heel-style.value_label&quot;: &quot;wedge&quot;
                                  }
                              }
                          ]
                      }
                  }
              ]
          }
      }
  }
  </code></pre>