title: Create Postgres JSONB Index on Array Sub-Object
body: <p>I have table <code>myTable</code> with a JSONB column <code>myJsonb</code> with a data structure that I want to index like:</p>
  
  <pre><code>{
    "myArray": [
      {
        "subItem": {
          "email": "bar@bar.com"
        }
      },
      {
        "subItem": {
          "email": "foo@foo.com"
        }
      }
    ]
  }
  </code></pre>
  
  <p>I want to run indexed queries on <code>email</code> like:</p>
  
  <pre><code>SELECT *
  FROM mytable
  WHERE 'foo@foo.com' IN (
    SELECT lower(
        jsonb_array_elements(myjsonb -&gt; 'myArray')
        -&gt; 'subItem'
        -&gt;&gt; 'email'
    )
  );
  </code></pre>
  
  <p>How do I create a Postgres JSONB index for that?</p>