Created
March 15, 2019 07:44
-
-
Save gizemabali/e81d3483f79894a0a8922d183b0478ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
// create client | |
ElasticsearchClient client = new ElasticsearchClient(); | |
String startDateStr = "2018-10-01T00:00:00.000Z"; | |
String endDateStr = "2019-03-15T00:00:00.000Z"; | |
QueryBuilder query = QueryBuilders.matchQuery(<key>, <Id>); | |
SearchRequestBuilder searchBuilder = client.prepareSearch(); | |
SearchResponse scrollResp = searchBuilder.setIndices(<index_name>).setTypes(<index_type_name>).setQuery(query) | |
.setPostFilter(QueryBuilders.rangeQuery(TIMESTAMP).from(startDateStr).to(endDateStr)) | |
.setSize(MAX_BULK_SIZE).setScroll(KEEP_ALIVE_FIVE_MINUTE).execute().actionGet(); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment