【问题标题】:Elasticsearch custom query for getting elements of particular range?用于获取特定范围元素的 Elasticsearch 自定义查询?
【发布时间】:2017-04-12 11:04:33
【问题描述】:

我是 Elasticsearch 的新手,所以,这是我的疑问:

I have large data inserted into Elastic search. The data that I have inserted contains an attribute of marks of each subject, is it possible to write an Elasticsearch query to find the number of students who has their marks in the inputted range.

示例:

|studentname | maths | computers |
++++++++++++++++++++++++++++++++++
|s1          |78     |90         |
==================================
|s2          |56     |75         |
==================================
|s3          |45     |50         |
==================================

假设 ES 中的数据以表格形式存在,是否有可能

1.查找计算机成绩超过50分的学生名单。

2.查找两科均分超过60分的学生名单。

【问题讨论】:

    标签: elasticsearch spring-data-elasticsearch


    【解决方案1】:

    使用范围查询:-

    {  
       "query":{"bool":{"must":{"range":{computers:{gte: 50} }}}}
    }
    

    查看link

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-30
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多