2016-10-07 69 views
0

我在Elasticsearch中有這個JSON結構。我無法創建DSL來搜索的所有null值,這些值介於A和B的post.timestamp範圍之間。我該怎麼做?Elasticsearch DSL的2個時間戳之間的所有空值

{ 
    "tracer": { 
    "post": {"timestamp": 123123}, 
    "awsKafkaTimestamp": null, 
    "qdcKafkaTimestamp": null 
    } 
} 
+0

,你需要大約elasticsearch的Python-DSL? – ChintanShah25

回答

1

試試這個:(作品ES 2.4 - 不會對2.2及以下工作)

{ 

    "fields" : ["your_field"], 
    "query" : { 
     "bool" : { 
      "must_not" : { 
       "exists" : { 
        "field" : "awsKafkaTimestamp " 
       } 
      }, 
      "must" : [{ 
        "nested" : { 
         "path" : "post", 
         "filter" : { 
          "bool" : { 
           "must" : { 
            "range" : { 
             "post.timestamp" : { 
              "lte" : A, 
              "gte" : B 
             } 
            } 
           } 
          } 
         } 
        } 

       } 
      ] 
     } 
    } 
}