- Elasticsearch Blueprints
- Vineeth Mohan
- 192字
- 2021-07-16 13:39:33
Implementing a prize range filter
Now, let's move on and see how to implement a prize range filter as seen in some e-commerce websites. Consider the following screenshot of an e-commerce site:

In the preceding screenshot, you can see a price range filter on the left-hand side tab. By clicking on or specifying the price ranges, the products that fall within that range would be displayed. This is nothing but a numeric range filter.
The implementation of a numeric range filter is almost similar to the date range filter in Elasticsearch. The following code snippet shows how to implement a numeric range filter. Here is the sample; assume that you have an age
field that is numeric in nature:
{ "filtered" : { "filter" : { "range" : { "age" : { "gte": 10, "lte": 20 } } } } }
After reading the implementation of filters, which is to be followed, you would understand the snippet completely. For time being, we have just showed you how to implement a filter in a numeric field in Elasticsearch.
The same parameters that are shown in the previous table are applied here as well.
- 從學徒到高手:汽車電路識圖、故障檢測與維修技能全圖解
- Symfony2 Essentials
- 51單片機C語言開發教程
- C和C++游戲趣味編程
- Python語言實用教程
- 現代C++編程實戰:132個核心技巧示例(原書第2版)
- AutoCAD 2009實訓指導
- Node學習指南(第2版)
- Getting Started with Python and Raspberry Pi
- R語言:邁向大數據之路(加強版)
- 30天學通C#項目案例開發
- Groovy 2 Cookbook
- Java Web開發基礎與案例教程
- Ionic3與CodePush初探:支持跨平臺與熱更新的App開發技術
- 例解Python:Python編程快速入門踐行指南