title: how to use "or" operator with CriteriaQuery in spring-data-elasticsearch
body: <p>Recently, I am trying use <code>spring-data-elasticsearch</code> in my project and met lots of problems.I asked a question about <code>not</code> operation yesterday but I solved by myself.And now I met another problem when trying to use <code>or</code> operator.</p>
  
  <p>Here is what I want:</p>
  
  <p>I want to query an object with a <code>code</code> that is not "11" and its <code>symbol</code> is "22" or its <code>subSymbol</code> is "33".I have tried many times in many ways and failed.It seems that I have no way to make it work with CriteriaQuery. I don't know if I described my question clearly.And in SQL,it should be written like this,</p>
  
  <pre><code>select from x where x.code!='11' and (x.symbol='22' or x.subSymbol='33')
  </code></pre>
  
  <p>But with CriteriaQuery,I always get the results if <code>symbol/subSymbol</code> value is matched and <code>code</code> condition seems missing, its SQL works like below:</p>
  
  <pre><code>select from x where x.code!='11' or x.symbol='22' or x.subSymbol='33'
  </code></pre>
  
  <p>Here is what I try:</p>
  
  <pre><code>1.
  CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria()
                  .and("code").is("11").not()
                  .or("symbol").is("22").or("subSymbol").is("33"));
  2.
  CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria()
                  .and("code").is("11").not()
                  .or(new Criteria("symbol").is("22").and("subSymbol").is("33")));
  
  
  3.
  CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria()
                  .and("code").is("11").not()
                  .and(new Criteria("symbol").is("22").or("subSymbol").is("33")));
  
  4.
  CriteriaQuery criteriaQuery = new CriteriaQuery(new Criteria()
                  .and("code").is("11").not())
                  .addCriteria(new Criteria("symbol").is("22").or("subSymbol").is("33"));
  
  
  List&lt;xx&gt; sampleEntities =
                  elasticsearchTemplate.queryForList(criteriaQuery,xx.class);
  </code></pre>
  
  <p>All of above failed.</p>
  
  <p>So any solution to deal with my problem? Or I need to try NativeSearchQueryBuilder maybe.It is so frustrating.</p>