1 index
2 types
Elasticsearch
type1
。我想查询type2
中SELECT * FROM index/type1 AS t1 WHERE t1.uid NOT IN (SELECT t2.uid FROM index/type2 AS t2)
中不存在的所有记录。
SQL等价物就像;
let task: NSURLSession
task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -> Void in
dispatch_async(dispatch_get_main_queue(), {
//remove from queue
weakself?.popTask(task: task)
}
有关如何解决这个问题的任何建议?我正在使用elasticsearch-2.2.0(Java API)。谢谢!
答案 0 :(得分:0)
您尝试做的事情绝对不可能使用Elasticsearch,因为它不是relational store。
有可能避免明确地传递术语,但它们应该出现在某个文档的某些字段中(Terms lookup):
{
"bool": {
"must_not": {
"term": {
"uid": {
"index": "document-index",
"type": "document-type",
"id": "document-id",
"path": "path-to-the-array-property-containing-the-terms"
}
}
}
}
}