Reputation: 107
I am migrating a java application from elastic search high level client to java api client.
There is a range query like this in the code.
QueryBuilders.rangeQuery("startDate").lte(dateUtils.today())
Need to change this to java api client code.
Could someone help on this?
Upvotes: 1
Views: 1390
Reputation: 1019
Another way to create a similar query using Query.of()
Query dateRangeQuery = Query.of(q -> q
.range(r -> r
.field("field")
.lte(dateUtils.today())
)
);
Upvotes: 0
Reputation: 36
https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/searching.html
Query dateRangeQuery = RangeQuery.of(r -> r
.field("startDate")
.lte(dateUtils.today())
)._toQuery();
Upvotes: 2