Filtering by a single type's field


#1

I'm searching through several types of objects in elastic and was wondering if I can filter results by just one type's field. For example, I have books and magazines objects and book object has boolean property "paperback". So I want to get all books and magazines, except the ones where books.paperback = false.
What would be the easiest way to achieve that? Thanks!


(Adrien Grand) #2

Is books the only type that has a paperback field? If yes, you can just use a must_not clase on that field. Otherwise, you will have to combine it with a type query.


#3

Thanks! Yes, this is the case. I was using a rather old version of Elastic with and filters. Must_not does exactly what I needed.


(system) #4

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