title: Transform SearchHit to Java Object in ElasticSearch
body: <p>I am trying to retrieve data form ES query and I am confused about how can I transform each hit of retrieved data to Java Object. 
  Until now, I can get each hit in JSON format using Gson but I think is useless to transform from Hit to JSON and then to Java Object. </p>
  
  <p>My current code is:</p>
  
  <pre><code>TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
              .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
      Settings settings = Settings.builder()
              .put("cluster.name", "elasticsearch")
              .put("path.home", "/Users/user/Apps/elasticsearch-5.4.1")
              .build();
  
      QueryBuilder qb = termQuery("price", 12);
      SearchResponse response = client.prepareSearch("kal").setTypes("products")
              .setSearchType(SearchType.DEFAULT)
              .setQuery(qb)
              .get();
  
      SearchHit[] results = response.getHits().getHits();
      for (SearchHit hit : results) {
          String sourceAsString = hit.getSourceAsString();
          Map&lt;String, SearchHitField&gt; responseFields = hit.getFields();
          if (sourceAsString != null) {
              Gson gson = new GsonBuilder().setDateFormat(sourceAsString)
                      .create();
          }
      }
  </code></pre>