mirror of
https://github.com/simon987/od-database.git
synced 2025-04-19 10:26:44 +00:00
Fixed indentation error
This commit is contained in:
parent
4c9d79fdbf
commit
9ff21e7943
@ -406,39 +406,39 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|
||||||
def stream_all_docs(self):
|
def stream_all_docs(self):
|
||||||
return helpers.scan(query={
|
return helpers.scan(query={
|
||||||
"query": {
|
"query": {
|
||||||
"match_all": {}
|
"match_all": {}
|
||||||
}
|
}
|
||||||
}, scroll="5m", client=self.es, index=self.index_name)
|
}, scroll="5m", client=self.es, index=self.index_name)
|
||||||
|
|
||||||
|
|
||||||
def are_empty(self, websites):
|
def are_empty(self, websites):
|
||||||
result = self.es.search(body={
|
result = self.es.search(body={
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"filter": {
|
"filter": {
|
||||||
|
"terms": {
|
||||||
|
"website_id": websites
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"websites": {
|
||||||
"terms": {
|
"terms": {
|
||||||
"website_id": websites
|
"field": "website_id",
|
||||||
},
|
"size": 100000,
|
||||||
|
"min_doc_count": 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"size": 0
|
||||||
"aggs": {
|
}, index=self.index_name, request_timeout=30)
|
||||||
"websites": {
|
|
||||||
"terms": {
|
|
||||||
"field": "website_id",
|
|
||||||
"size": 100000,
|
|
||||||
"min_doc_count": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"size": 0
|
|
||||||
}, index=self.index_name, request_timeout=30)
|
|
||||||
|
|
||||||
non_empty_websites = [bucket["key"] for bucket in result["aggregations"]["websites"]["buckets"]]
|
non_empty_websites = [bucket["key"] for bucket in result["aggregations"]["websites"]["buckets"]]
|
||||||
|
|
||||||
for website in websites:
|
for website in websites:
|
||||||
if website not in non_empty_websites:
|
if website not in non_empty_websites:
|
||||||
yield website
|
yield website
|
||||||
|
Loading…
x
Reference in New Issue
Block a user