elasticsearch in java code example
Example 1: implement elasticsearch filter in java
{
"size": 100,
"from": 0,
"query":
{
"match_all": {}
},
"filter" : {
"term" : {
"activated" : "true"
}
}
}
FilteredQueryBuilder builder =
QueryBuilders.filteredQuery(QueryBuilders.termQuery("test",
"test"),FilterBuilders.termFilter("key","value"));
Example 2: implement elasticsearch filter in java
FilteredQueryBuilder builder = QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(),
FilterBuilders.termFilter("username","stackoverflow"));