Examples of sourceAsString()


Examples of org.elasticsearch.action.get.GetResponse.sourceAsString()

    public Article findBySlug(String slug) {
        GetResponse response = node.client().prepareGet(INDEX, TYPE, slug).execute().actionGet();
        if (response.exists()) {
            try {
                return json.readValue(response.sourceAsString(), Article.class);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
View Full Code Here

Examples of org.elasticsearch.search.SearchHit.sourceAsString()

    assertThat(result.getName(), is("Ford"));
  }

  private SearchHit createCarHit(String name, String model) {
    SearchHit hit = mock(SearchHit.class);
    when(hit.sourceAsString()).thenReturn(createJsonCar(name, model));
    return hit;
  }

  private SearchHit createCarPartialHit(String name, String model) {
    SearchHit hit = mock(SearchHit.class);
View Full Code Here

Examples of org.elasticsearch.search.SearchHit.sourceAsString()

    return hit;
  }

  private SearchHit createCarPartialHit(String name, String model) {
    SearchHit hit = mock(SearchHit.class);
    when(hit.sourceAsString()).thenReturn(null);
    when(hit.getFields()).thenReturn(createCarFields(name, model));
    return hit;
  }

  private String createJsonCar(String name, String model) {
View Full Code Here

Examples of org.elasticsearch.search.SearchHit.sourceAsString()

            if (hitsItr != null) {
                if (recordsRead < recsToRead) {
                    if (hitsItr.hasNext()) {
                        SearchHit hit = hitsItr.next();
                        key.set(hit.id());
                        val.set(hit.sourceAsString());
                        recordsRead += 1;
                        return true;
                    }
                } else {
                    hitsItr = null;
View Full Code Here

Examples of org.elasticsearch.search.SearchHit.sourceAsString()

                if (recordsRead < recsToRead) {
                    hitsItr = fetchNextHits();
                    if (hitsItr.hasNext()) {
                        SearchHit hit = hitsItr.next();
                        key.set(hit.id());
                        val.set(hit.sourceAsString());
                        recordsRead += 1;
                        return true;
                    }
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.