Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj
This commit is contained in:
+4
-2
@@ -37,7 +37,8 @@ class RegionStandardBatch extends BaseBatch{
|
|||||||
seaweedRegionStandardByCat("shop")
|
seaweedRegionStandardByCat("shop")
|
||||||
}
|
}
|
||||||
def poiRegionStandard(){
|
def poiRegionStandard(){
|
||||||
def citys = ["三明","龙岩","南平","漳州","福州","厦门","泉州","莆田","宁德"]//CommonDatautils.findAllCity()
|
//"三明","龙岩","南平","漳州","福州","厦门","泉州","莆田","宁德",
|
||||||
|
def citys = ["重庆"]//CommonDatautils.findAllCity()
|
||||||
for(def city : citys){
|
for(def city : citys){
|
||||||
|
|
||||||
def data = fullCityMap.get(city)
|
def data = fullCityMap.get(city)
|
||||||
@@ -209,7 +210,7 @@ class RegionStandardBatch extends BaseBatch{
|
|||||||
def m = [:]
|
def m = [:]
|
||||||
m.put(d.id, ["status":1])
|
m.put(d.id, ["status":1])
|
||||||
results << m
|
results << m
|
||||||
if(results.size()%1==0){
|
if(results.size()%100==0){
|
||||||
updateRegionByEs(results)
|
updateRegionByEs(results)
|
||||||
results.clear()
|
results.clear()
|
||||||
}
|
}
|
||||||
@@ -223,6 +224,7 @@ class RegionStandardBatch extends BaseBatch{
|
|||||||
updateRegionByEs(results)
|
updateRegionByEs(results)
|
||||||
results.clear()
|
results.clear()
|
||||||
}
|
}
|
||||||
|
println city +" 处理完成"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -242,21 +242,21 @@ class ElasticUtils89 {
|
|||||||
String scrollId = searchResponse.getScrollId();
|
String scrollId = searchResponse.getScrollId();
|
||||||
SearchHit[] searchHits = searchResponse.getHits().getHits();
|
SearchHit[] searchHits = searchResponse.getHits().getHits();
|
||||||
def results = []
|
def results = []
|
||||||
// while (searchHits != null && searchHits.length > 0) {
|
while (searchHits != null && searchHits.length > 0) {
|
||||||
for (int k=0; k < searchHits.size(); k++) {
|
for (int k=0; k < searchHits.size(); k++) {
|
||||||
SearchHit searchHit = searchHits[k]
|
SearchHit searchHit = searchHits[k]
|
||||||
searchHit.getSourceAsMap().put("id", searchHit.getId());
|
searchHit.getSourceAsMap().put("id", searchHit.getId());
|
||||||
results << searchHit.getSourceAsMap()
|
results << searchHit.getSourceAsMap()
|
||||||
}
|
}
|
||||||
// if(results.size()%100000==0){
|
if(results.size()%100000==0){
|
||||||
// println "."+ new Date()
|
println "."+ new Date()
|
||||||
// }
|
}
|
||||||
// SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
|
SearchScrollRequest scrollRequest = new SearchScrollRequest(scrollId);
|
||||||
// scrollRequest.scroll(scroll);
|
scrollRequest.scroll(scroll);
|
||||||
// searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT);
|
searchResponse = client.scroll(scrollRequest, RequestOptions.DEFAULT);
|
||||||
// scrollId = searchResponse.getScrollId();
|
scrollId = searchResponse.getScrollId();
|
||||||
// searchHits = searchResponse.getHits().getHits();
|
searchHits = searchResponse.getHits().getHits();
|
||||||
// }
|
}
|
||||||
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
|
ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
|
||||||
clearScrollRequest.addScrollId(scrollId);
|
clearScrollRequest.addScrollId(scrollId);
|
||||||
client.clearScroll(clearScrollRequest, RequestOptions.DEFAULT);
|
client.clearScroll(clearScrollRequest, RequestOptions.DEFAULT);
|
||||||
|
|||||||
Reference in New Issue
Block a user