From the course: Elasticsearch Essential Training

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Working with a DSL filter context

Working with a DSL filter context - Elastic Stack Tutorial

From the course: Elasticsearch Essential Training

Working with a DSL filter context

- [Instructor] Filter context in Elasticsearch DSL is used for doing the exact matching. It does not do any relevant searches. Let's take an example. Imagine that you wanted to find all the in stock products in the electronics category. You can write the query something like this. Here we are using the filter context and we are saying that the category should be equal to electronics, and we are saying that in stock is true. Now this will give me all the products where both of these two are true. You can see that for this product the category is electronics and in stock is true. The same is for that next product as well. In some cases, you wanted to search based on the multiple values. In that case, you can use the terms. Remember, in the previous search we have used the term, but here for multiple values, I'm using the terms. Now in this case, it'll try to identify all those product where category is either electronics or mobile. So whenever you have to search for a multiple, you're…

Contents