title: Search in array by array of values in Azure Cosmos DB
body: <p>Document contains field Tags with array of strings, e.g [&quot;tag1&quot;, &quot;tag2&quot;, &quot;tag3&quot;]. How can I get all documents both with tag1 and tag2?</p>
  <p>I've tried ARRAY_CONTAINS, but with this query, CosmosDB returns all documents with tag1 and all documents with tag2, not only where tag1 and tag2 are together.</p>
  <pre><code>SELECT VALUE files FROM files JOIN tag IN files.Tags WHERE IS_DEFINED(files.Tags) AND ARRAY_CONTAINS([&quot;tag1&quot;, &quot;tag2&quot;], tag, false)
  </code></pre>
  <p>My sample data</p>
  <pre><code>[
      {
          &quot;id&quot;: &quot;23244d53-f4ba-4bf5-90a4-a4073a759232&quot;,
          &quot;Tags&quot;: [
              &quot;tag1&quot;,
              &quot;tag2&quot;
          ]
      },
      {
          &quot;id&quot;: &quot;23244d53-f4ba-4bf5-90a4-a4073a759232&quot;,
          &quot;Tags&quot;: [
              &quot;tag1&quot;,
              &quot;tag3&quot;
          ]
      },
      {
          &quot;id&quot;: &quot;0bbd57d1-38cb-4094-81cf-33703448bbcd&quot;,
          &quot;Tags&quot;: [
              &quot;tag1&quot;
          ]
      }
   ]
  </code></pre>