I have build a web app on top of elasticsearch. I would like to do a multiple filter using Java.
Elasticsearch Query:
{
"query": {
"bool": {
"must": [
{"match": {
"T": "TEXT"},
"match": {
"new_content": "TEXT"
}
},
],
"filter": {
"term": {
"collection": "xyz"
},
"term": {
"collection": "abc"
}
I want to filter the query such that it should filter on the same field collection
with two different values(for eg,"xyz" and "abc")
Right now, I have coded a Java program for the single filter.
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery()
.must(QueryBuilders.simpleQueryStringQuery(query).field("newContent").field("T"))
.filter(QueryBuilders.termQuery(Collection, "abc"));
How should I filter a query on the same field for multiple values?