Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
VachaShah committed Mar 3, 2023
1 parent 2d13785 commit 0da2119
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [Create an index](#create-an-index)
- [Index data](#index-data)
- [Search for the documents](#search-for-the-documents)
- [Get results in terms of raw JSON](#get-results-in-terms-of-raw-json)
- [Get raw JSON results](#get-raw-json-results)
- [Search documents using a match query](#search-documents-using-a-match-query)
- [Bulk requests](#bulk-requests)
- [Aggregations](#aggregations)
Expand Down Expand Up @@ -131,12 +131,15 @@ for (int i = 0; i < searchResponse.hits().hits().size(); i++) {
}
```

### Get results in terms of raw JSON
### Get raw JSON results

When the target class is not defined or if the response result is a semi-structured data not tied to an object definition, use a raw JSON data representation as the target class. For example, the below snippet uses `ObjectNode` from jackson.

```java
SearchResponse<ObjectNode> search = client.search(b -> b.index(index), ObjectNode.class);
SearchResponse<ObjectNode> searchResponse = client.search(b -> b.index(index), ObjectNode.class);
for (int i = 0; i < searchResponse.hits().hits().size(); i++) {
System.out.println(searchResponse.hits().hits().get(i).source());
}
```

## Search documents using a match query
Expand Down

0 comments on commit 0da2119

Please sign in to comment.