elasticsearch,Python,elasticsearch" /> elasticsearch,Python,elasticsearch" />

Python elasticsearch查询一天中的小时数

Python elasticsearch查询一天中的小时数,python,elasticsearch,Python,elasticsearch,我正在使用elasticsearch python客户端 我的索引中有一个日期范围字段。我要下午12点到2点之间的文件。这就是我写的问题 query = {"query":"filter": [{"range" : { "status_time_frame" : {"gte" : "10/11/2017","lte" : "13/11/2017", "relation":"within"}}}],{"script":{"source": "doc.status_time_frame.status

我正在使用elasticsearch python客户端

我的索引中有一个日期范围字段。我要下午12点到2点之间的文件。这就是我写的问题

query = {"query":"filter": [{"range" : { "status_time_frame" : {"gte" : "10/11/2017","lte" : "13/11/2017", "relation":"within"}}}],{"script":{"source": "doc.status_time_frame.status_time_frame.getHourOfDay() >= min && doc.status_time_frame.status_time_frame.getHourOfDay() <= max","params": {"min":12,"max":14}}}}

query={“query”:“filter”:[{“range”:{“status\u time\u frame”:{“gte”:“10/11/2017”,“lte”:“13/11/2017”,“relation”:“within”}}}}}}],{“script”:{“source”:“doc status\u time\u frame.status\u time\u frame.getHourOfDay()>=min&&doc status\u time\u frame.getHourOfDay()=min&&doc status\u time\u frame.getHourOfDay())正确的查询应该如下所示:

{
  "query": {
    "filter": [
      {
        "range": {
          "status_time_frame": {
            "gte": "10/11/2017",
            "lte": "13/11/2017"
          }
        }
      },
      {
        "script": {
          "source": "doc.status_time_frame.status_time_frame.getHourOfDay() >= min && doc.status_time_frame.status_time_frame.getHourOfDay() <= max",
          "params": {
            "min": 12,
            "max": 14
          }
        }
      }
    ]
  }
}
{
“查询”:{
“过滤器”:[
{
“范围”:{
“状态时间框架”:{
“gte”:“2017年11月10日”,
“lte”:“2017年11月13日”
}
}
},
{
“脚本”:{

“source:“doc.status\u time\u frame.status\u time\u frame.getHourOfDay()>=min&&doc.status\u time\u frame.status\u time\u frame.getHourOfDay()您需要从您的
范围中删除
内的关系:
查询时,仍然给我语法错误。您在
过滤器之前还缺少一个开放的大括号”
@Val bro感谢您的回复和帮助。但我仍然发现了错误。我已经尝试了所有方法。您能在答案中写下完整的查询吗?谢谢。这方面有什么进展吗?
{
  "query": {
    "filter": [
      {
        "range": {
          "status_time_frame": {
            "gte": "10/11/2017",
            "lte": "13/11/2017"
          }
        }
      },
      {
        "script": {
          "source": "doc.status_time_frame.status_time_frame.getHourOfDay() >= min && doc.status_time_frame.status_time_frame.getHourOfDay() <= max",
          "params": {
            "min": 12,
            "max": 14
          }
        }
      }
    ]
  }
}