+6
-3
@@ -37,7 +37,9 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{
|
|||||||
//删除旧的,再同步新的
|
//删除旧的,再同步新的
|
||||||
ADMINISTRATIVE_MAPPING_COLL_100.remove(new BasicDBObject())
|
ADMINISTRATIVE_MAPPING_COLL_100.remove(new BasicDBObject())
|
||||||
|
|
||||||
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(new BasicDBObject()).batchSize(1000)
|
def q = new BasicDBObject()
|
||||||
|
// q.put("shape.type","MultiPolygon")
|
||||||
|
def dbcursor = ADMINISTRATIVE_MAPPING_COLL.find(q).batchSize(1000)
|
||||||
def datas = []
|
def datas = []
|
||||||
def retMap = [:]
|
def retMap = [:]
|
||||||
for(def d : dbcursor){
|
for(def d : dbcursor){
|
||||||
@@ -59,6 +61,7 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{
|
|||||||
|
|
||||||
def synchToEs(retMap, host, indexName){
|
def synchToEs(retMap, host, indexName){
|
||||||
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
|
QueryBuilder queryBuilder = QueryBuilders.boolQuery()
|
||||||
|
// queryBuilder.must(QueryBuilders.termQuery("street", "喀拉玛盖镇"))
|
||||||
def oldIds = new CopyOnWriteArrayList()
|
def oldIds = new CopyOnWriteArrayList()
|
||||||
|
|
||||||
ElasticUtils89.queryUpdate(host, indexName, queryBuilder, { String id, doc->
|
ElasticUtils89.queryUpdate(host, indexName, queryBuilder, { String id, doc->
|
||||||
@@ -69,11 +72,11 @@ class SynchAdministrativeMappingDataBatch extends BaseBatch{
|
|||||||
if(!["id","_id","c_date","m_date","polyline_source","operator","city_simple_pinyin","prefecture_level_city"].contains(k)){
|
if(!["id","_id","c_date","m_date","polyline_source","operator","city_simple_pinyin","prefecture_level_city"].contains(k)){
|
||||||
def val = doc.get(k)
|
def val = doc.get(k)
|
||||||
if(val!=v){
|
if(val!=v){
|
||||||
if(k!="shape"){// || (k=="shape" && v.type!="MultiPolygon")
|
// if(k!="shape" || (k=="shape" && v.type!="MultiPolygon")){
|
||||||
println k +" 修改 "+id
|
println k +" 修改 "+id
|
||||||
updateFieldCount++
|
updateFieldCount++
|
||||||
doc.put(k,v)
|
doc.put(k,v)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user