How to set Sort Order to "_doc" using TransportClient

I'm doing a Scroll request but I'm not sure how to set my sort order to "_doc" using the TransportClient.

The only options I see are

public SearchRequestBuilder addSort(String field, SortOrder order) {

and

public SearchRequestBuilder addSort(SortBuilder sort) {

I don't want to sort on a field so that didn't seem right. I looked for a SortBuilder but I only found those off of SortBuilders

Any help here would be great. and/or how to implement my own sortBuilder that returns the proper value.

Found it. Looks like you're meant to use:

.addSort(SortParseElement.DOC_FIELD_NAME, SortOrder.ASC)

per: https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-search-scrolling.html

1 Like