Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Elasticsearchj存在和不存在的实现_Sql_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch,Sql,elasticsearch" /> elasticsearch,Sql,elasticsearch" />

Sql Elasticsearchj存在和不存在的实现

Sql Elasticsearchj存在和不存在的实现,sql,elasticsearch,Sql,elasticsearch,elasticsearch中的等效查询? 大概是这样的: Select COUNT(distinct name) From index1 Where date between X and y And name in (Select name From index1 Where date between p and s) { "size" : 0, "query" : { "filtered" : {

elasticsearch中的等效查询?

大概是这样的:

Select COUNT(distinct name) 
From index1 
Where date between X and y 
And name in (Select name 
             From index1  
             Where date between p and s) 
{
  "size" : 0,
  "query" : {
    "filtered" : {
      "query" : {
        "match_all" : { }
      },
      "filter" : {
        "range" : {
          "date" : {
            "from" : "2015-03-10T21:51:47.703-04:00",
            "to" : "2015-03-20T21:51:47.727-04:00",
            "include_lower" : true,
            "include_upper" : true
          }
        }
      }
    }
  },
  "aggregations" : {
    "names1" : {
      "filter" : {
        "range" : {
          "date" : {
            "from" : "2015-02-28T21:51:47.733-05:00",
            "to" : "2015-03-20T21:51:47.734-04:00",
            "include_lower" : true,
            "include_upper" : true
          }
        }
      },
      "aggregations" : {
        "names2" : {
          "terms" : {
            "field" : "name"
          }
        }
      }
    }
  }
}