Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 7 years ago
parent
commit
2423512323

+ 5 - 5
patient-co/patient-co-statistics-es/doc/es/统计新增索引.txt

@ -1,11 +1,11 @@
创建索引
POST  http://172.19.103.68:9200/wlyy_quota_cwd
POST  http://172.19.103.68:9200/wlyy_quota_test
查询索引
GET http://172.19.103.68:9200/wlyy_quota_cwd/
GET http://172.19.103.68:9200/wlyy_quota_test/
给索引加mapping
POST http://172.19.103.68:9200/wlyy_quota_cwd/wlyy_quota_cwd/_mapping
POST http://172.19.103.68:9200/wlyy_quota_test/wlyy_quota_test/_mapping
{
    "wlyy_quota_cwd": {
    "wlyy_quota_test": {
            "properties": {
                "quotaCode": {
                    "type": "string",
@ -100,7 +100,7 @@ POST http://172.19.103.68:9200/wlyy_quota_cwd/wlyy_quota_cwd/_mapping
  }
增加索引搜索大小
PUT  http://172.19.103.68:9200/wlyy_quota_cwd/_settings
PUT  http://172.19.103.68:9200/wlyy_quota_test/_settings
{
  "index": {
    "max_result_window": 500000

+ 3 - 20
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElastricSearchSave.java

@ -47,10 +47,11 @@ public class ElastricSearchSave {
                try {
                    obj.setCreateTime(new Date());
                    Index index = new Index.Builder(obj).build();
                    success++;
                    bulk.addAction(index);
                } catch (Exception e) {
                    logger.error(e.getMessage());
                    error++;
                }
            }
            BulkResult br = jestClient.execute(bulk.build());
@ -73,18 +74,6 @@ public class ElastricSearchSave {
            int success = 0;
            int error = 0;
            boolean isSuccessed = true;
//            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
//            for (SaveModel obj : sms) {
//                try {
//                    obj.setCreateTime(new Date());
//                    Update index = new Update.Builder(obj).index(esIndex).type(esType).id(obj.getId()).build();
//                    bulk.addAction(index);
//                    success++;
//                } catch (Exception e) {
//                    error++;
//                }
//            }
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (SaveModel obj : sms) {
                try {
@ -93,13 +82,7 @@ public class ElastricSearchSave {
                    jo.put("doc",obj);
                    Update index = new Update.Builder(jo.toString()).index(esIndex).type(esType).id(obj.getId()).build();
                    bulk.addAction(index);
                  //  JestResult result = jestClient.execute(index);
//                    if (result.isSucceeded()) {
//                        success++;
//                    } else {
//                        error++;
//                        isSuccessed = false;
//                    }
                    success++;
                } catch (Exception e) {
                    error++;
                    isSuccessed = false;