title: Java : search for multiple fields in an index in elasticsearch
body: <p>What I'm trying to achieve here is to search for two fields in an index.
  The structure looks like this in kibana : </p>
  
  <pre><code>POST arempris/emptagnames
  {
    "mappings" : {
      "emptags":{
            "properties": {
                  "employeeid": {
                    "type":"integer"
                  },
                  "tagName": {
                    "type": "text",
                    "fielddata": true,
                    "analyzer": "english"
                  }
              }    
          }
      }
  }
  </code></pre>
  
  <p>In java, I had written a code to search for the single field named "tagName" and return the searchHits in jsonArrayBuilder format.</p>
  
  <p>Similarly to this, in this case, is it possible to search employeeid first and then return the list of tagNames associated to that employeeid?</p>
  
  <p>In case of RDBMS, my query would look like : 
  SELECT tagNames from filemetadata where employeeid = 124 and tagName like %slip% and this is what I'm looking to implement using QueryBuilder. Is it possible to implement?</p>
  
  <p>The java code to search for a single field in the index what I've written is :</p>
  
  <pre><code>Client esclient = getClient();
  
          String index = "arempris";
          String type = "tags";
  
          QueryBuilder query = QueryBuilders.matchPhrasePrefixQuery("tagName", tagName);
          SearchResponse response = esclient.prepareSearch(index).setTypes(type)
                  .setQuery(query)
                  .execute().actionGet();
  
          hits = response.getHits().getHits();
          System.out.println(hits.length);
          for (int i = 0; i &lt; hits.length; i++) {
              System.out.println(hits[i].getSourceAsString());
          }
  </code></pre>
  
  <p>Would greatly appreciate your help and thanks in advance.</p>