Using multiple filters in one filteredQuery in JAVA API


(Mohammed Essabri) #1

Hi,
I am working on a project using Elasticsearch 1.7 and i would use a query containing a search query and add two filters typeFilter() and termFilter

That's a part of my method in groovy code, i can not share the rest of the code, sorry for that :

private QueryBuilder method() {
def queryFilters = andFilter()
def archivalFilter = termFilter("archival", 0) // i want to search doc that have archival property equals 0
def typeFilter = bookIndex.getType() //

    queryFilters.add(typeFilter,archivalFilter )
    
    return return filteredQuery(query, queryFilters)

}

Note: before we had that:
return filteredQuery(query, typeFilter(bookIndex.getType()))
only and it worked fine!

Thank you in advance


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.