来自官方的Range Query查询介绍【全英文】

Matches documents with fields that have terms within a certain range. The type of the Lucene query depends on the field type, for string fields, the TermRangeQuery, while for number/date fields, the query is a NumericRangeQuery. The following example returns all documents where age is between 10 and 20:

{
    "range" : {
        "age" : {
            "gte" : 10,
            "lte" : 20,
            "boost" : 2.0
        }
    }
}

The range query accepts the following parameters:


gte


Greater-than or equal to


gt


Greater-than


lte


Less-than or equal to


lt


Less-than


boost


Sets the boost value of the query, defaults to 1.0

Ranges on date fieldsedit

When running range queries on fields of type date, ranges can be specified using the section called “Date Mathedit”::

{
    "range" : {
        "date" : {
            "gte" : "now-1d/d",
            "lt" :  "now/d"
        }
    }
}

Date math and roundingedit

When using date math to round dates to the nearest day, month, hour, etc, the rounded dates depend on whether the ends of the ranges are inclusive or exclusive.

Rounding up moves to the last millisecond of the rounding scope, and rounding down to the first millisecond of the rounding scope. For example:


gt


Greater than the date rounded up: 2014-11-18||/M becomes 2014-11-30T23:59:59.999, ie excluding the entire month.


gte


Greater than or equal to the date rounded down: 2014-11-18||/M becomes 2014-11-01, ie including the entire month.


lt


Less than the date rounded down: 2014-11-18||/M becomes 2014-11-01, ie excluding the entire month.


lte


Less than or equal to the date rounded up: 2014-11-18||/M becomes 2014-11-30T23:59:59.999, ie including the entire month.

Date format in range queriesedit

Formatted dates will be parsed using the format specified on the date field by default, but it can be overridden by passing the format parameter to the range query:

{
    "range" : {
        "born" : {
            "gte": "01/01/2012",
            "lte": "2013",
            "format": "dd/MM/yyyy||yyyy"
        }
    }
}

Time zone in range queriesedit

Dates can be converted from another timezone to UTC either by specifying the time zone in the date value itself (if the format accepts it), or it can be specified as the time_zone parameter:

{
    "range" : {
        "timestamp" : {
            "gte": "2015-01-01 00:00:00", 
            "lte": "now", 
            "time_zone": "+01:00"
        }
    }
}


This date will be converted to 2014-12-31T23:00:00 UTC.



now is not affected by the time_zone parameter (dates must be stored as UTC).

时间: 2024-08-16 02:23:22

来自官方的Range Query查询介绍【全英文】的相关文章

MongoDB官方C#驱动中查询条件Query用法

http://www.cnblogs.com/viprx/archive/2012/09/06/2673693.html MongoDB条件查询的基本语法. Query.All("name", "a", "b");//通过多个元素来匹配数组  Query.And(Query.EQ("name", "a"), Query.EQ("title", "t"));//同时满足

coacoapods中的podfile介绍;如何指定版本号(内容来自官方英文blog)

一个简单的podfile: pod 'AFNetworking', '~> 1.0' 版本号可以是1.0,可以是1.1,1.9,但必须小于2 -个更简单的podfile: pod 'AFNetworking', '1.0' // 版本号指定为1.0 一个更更简单的podfile: pod 'AFNetworking', // 不指定版本号,任何版本都可以 一个复杂的podfile:  platform :ios, '6.0' inhibit_all_warnings! xcodeproj 'My

50.常用的query查询方式

主要知识点 match all match multi match range query term query terms query exist query 1.match all 查询所有 GET /_search { "query": { "match_all": {} } } 示例: GET /company/employee/_search { "query": { "match_all": {} } } 2.ma

解决query查询输入geometry参数查询不到而通过where条件可以查到的问题

解决query查询输入geometry参数查询不到而通过where条件可以查到的问题 原因: 是因为geometry的坐标系和所要查询的图层不一样导致的(问题引起是由于底图中叠加了不同的坐标系的引起的) 问题描述: 我在公司做好的功能并且测好了,到现场出了问题,发现通过where语句查询时正常的,拉宽查询不正常.并且通过网页打开图层查询请求页面,手动输入代码中得到的geometry查询是可以查到数据的. 问题解决过程: 通过fiddler跟踪请求的http路径(因为arcgisAPI请求arcg

delphi中用Table表组件和Query查询组件配合进行的增删改查

一.打开数据库表进入检索状态 var Table1:TTable; //定义Table1为TTable类型的变量 begin Table1:=TTable.Create(self);//自建表 Table1:=DatabaseName:='rsgl';//数据库名 Table1:=TableName:='operator.db' //打开数据库Table表 文件名是"operator.db" Table1.Open;   //Table1表开启状态 Table1.SetKey; //将

主流数据库分页查询介绍

1 背景概述 由于在项目中需要在页面上显示数量非常多的数据, 在进行数据库查询时首先会把所有的数据都查询出来,然后在进行显示,这时候分页查询的操作就必不可少了,本文介绍Mysql.Oracle.sql Server 三种数据库进行分页查询的用法. 2 预期读者 数通畅联内部员工 广大计算机爱好者 3 名词解释 分页查询 就是将将过多的结果在有限的界面上分多页来显示,一般将分页查询分为两类:逻辑分页.物理分页.    逻辑分页是在用户第一次访问时,将数据库的所有记录全部查询出来,添加到一个大集合中

ArcGIS API for Javascript 使用query查询以某个点为半径的圆内的要素出现“esri.config.defaults.io.proxyUrl 尚未进行设置”错误

当使用Query查询时,会用如下配置 var queryTask = new esri.tasks.QueryTask(applicationModelOneSearchPOIURL); var query = new esri.tasks.Query(); query.geometry = geometry; query.outSpatialReference = map.spatialReference; query.spatialRelationship = esri.tasks.Quer

分享知识-快乐自己:Hibernate 中Criteria Query查询详解

1):Hibernate 中Criteria Query查询详解 当查询数据时,人们往往需要设置查询条件.在SQL或HQL语句中,查询条件常常放在where子句中. 此外,Hibernate还支持Criteria查询(Criteria Query),这种查询方式把查询条件封装为一个Criteria对象. 在实际应用中,使用Session的createCriteria()方法构建一个org.hibernate.Criteria实例,然后把具体的查询条件通过Criteria的add()方法加入到Cr

edgedb-js 来自官方的js 驱动

目前对于edgedb 主要还是来自官方的python驱动,目前js 版本的已经快发布了,代码在github 可以看到了 同时官方文档也提供了一个关于edgedb 内部的协议说明,结合js 驱动以及文档我们可以方便学习 内部协议参考资料 https://edgedb.com/docs/internals/protocol/overview 参考资料 https://github.com/edgedb/edgedb-js 原文地址:https://www.cnblogs.com/rongfengli