All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nbcp.myoql.db.es.extend.RestHighLevelClientExtend.kt Maven / Gradle / Ivy

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()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy