|
|
|
@ -76,7 +76,7 @@ public class IotMonitoringDataJob { |
|
|
|
/** |
|
|
|
* 当前索引日期后缀 |
|
|
|
*/ |
|
|
|
private static String currIndicsDateSuffix; |
|
|
|
private static String currIndicesDateSuffix; |
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception { |
|
|
|
|
|
|
|
@ -512,12 +512,12 @@ public class IotMonitoringDataJob { |
|
|
|
|
|
|
|
private static void checkIndicesIsExists(String indexDateSuffix, String indicesName) { |
|
|
|
|
|
|
|
if(currIndicsDateSuffix == null) { |
|
|
|
if(currIndicesDateSuffix == null) { |
|
|
|
// 当前月的索引为空 |
|
|
|
createIndices(indicesName, indexDateSuffix); |
|
|
|
}else { |
|
|
|
// 校验当前消息能否符合当前索引 |
|
|
|
if(!indexDateSuffix.equals(currIndicsDateSuffix)) { |
|
|
|
if(!indexDateSuffix.equals(currIndicesDateSuffix)) { |
|
|
|
// 如果不符合,需要重建索引 |
|
|
|
createIndices(indicesName, indexDateSuffix); |
|
|
|
} |
|
|
|
@ -585,7 +585,7 @@ public class IotMonitoringDataJob { |
|
|
|
if(!acknowledged || !shardsAcknowledged) { |
|
|
|
throw new Exception("自定义索引创建失败!!!"); |
|
|
|
} |
|
|
|
currIndicsDateSuffix = indexDateSuffix; |
|
|
|
currIndicesDateSuffix = indexDateSuffix; |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
|