Elasticsearch: searching a field containing an array of objects, ignoring some/ranking some differently
<p>I have objects of the following structure:</p>

<pre><code>{ "contents" : [ { "type": "A", "content": "something"},
                 { "type": "B", "content": "else"} ]}
</code></pre>

<p>(This is just an example, A or B could be present or not, there might also be C etc.).</p>

<p>I want to search within the contents of the array, but only those of type "A". At other times, i'd like to rank results higher if the text is contained in an "A".</p>

<p>Is this possible doing elastic search? Several musts seem to not help since I need to make sure A has the content, not that A or B has the content and that A is present.</p>

<p>I prefer not to change the structure of the objects that are indexed.</p>

<p>Thank you very much</p>