nbcp.myoql.db.es.extend.RestHighLevelClientExtend.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktmyoql Show documentation
Show all versions of ktmyoql Show documentation
kotlin orm -- mysql,mongo , just like ktorm
The newest version!
package nbcp.myoql.db.es.extend
import nbcp.base.comm.JsonMap
import nbcp.base.extend.*
import org.elasticsearch.client.*
/**
* Created by udi on 17-7-10.
*/
/**
* 获取所有别名索引。
*/
fun RestClient.getAllIndex(): Set {
var result = this.performRequest(Request("GET", "/_cat/aliases?format=json"));
if (result.statusLine.statusCode != 200) {
return setOf()
}
var list = result.entity.content.readContentString().FromListJson(JsonMap::class.java);
return list
.filter { it.get("is_write_index").AsBoolean() }
.map { it.get("alias").AsString() }
.toSet()
}