【问题标题】:how to find the date range in uri request search in elasticsearch如何在弹性搜索中的uri请求搜索中找到日期范围
【发布时间】:2016-02-08 08:48:28
【问题描述】:

我有一个搜索,我需要在其中找到数据的增量 http://localhost:9200/index/index_type/_search?q=sampledate[21-02-2015 至 22-02-2015]

但是这个搜索给了我错误 有人可以帮忙吗?

【问题讨论】:

  • 请发布更多细节和代码你的本地主机不会在这里工作..
  • 显示你的索引的映射

标签: elasticsearch


【解决方案1】:

您可以使用以下查询:

GET /index_name/index_type/_search?q=dateCreated:[2016-01-06+TO+2016-01-07]

仅当 dateCreateddate 字段时才有效。不适用于String

【讨论】:

【解决方案2】:

我们在 Elastic Search 7.6.1 中的这个日期字段有类似的奇怪问题。

我们通过删除日期字段后的冒号 (:) 并用括号括住整个日期查询部分找到了可行的解决方案。

即 GET /index_name/index_type/_search?q=dateCreated:[2016-01-06+TO+2016-01-07]

以上查询改为

GET /index_name/index_type/_search?q=(dateCreated[2016-01-06+TO+2016-01-07]) 这应该可以工作

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 2016-10-15
    • 1970-01-01
    • 2014-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多