Loading app/controllers/IndexSettingsController.scala 0 → 100644 +22 −0 Original line number Diff line number Diff line package controllers import models.ElasticServer import scala.concurrent.ExecutionContext.Implicits.global class IndexSettingsController extends BaseController { def get = process { (request, client) => client.getIndexSettingsFlat(request.get("index"), ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } def update = process { (request, client) => val index = request.get("index") val settings = request.getObj("settings") client.updateIndexSettings(index, settings, ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } } app/elastic/ElasticClient.scala +11 −1 Original line number Diff line number Diff line Loading @@ -88,6 +88,11 @@ trait ElasticClient { execute(s"${target.host}$path", "GET", None, target.authentication) } def getIndexSettingsFlat(index: String, target: ElasticServer) = { val path = s"/$index/_settings?flat_settings=true&include_defaults=true" execute(s"${target.host}$path", "GET", None, target.authentication) } def getIndexMapping(index: String, target: ElasticServer) = { val path = s"/$index/_mapping" execute(s"${target.host}$path", "GET", None, target.authentication) Loading Loading @@ -140,7 +145,7 @@ trait ElasticClient { def createIndex(index: String, metadata: JsValue, target: ElasticServer) = { val path = s"/$index" execute(s"${target.host}$path", "POST", Some(metadata.toString), target.authentication) execute(s"${target.host}$path", "PUT", Some(metadata.toString), target.authentication) } def getIndices(target: ElasticServer) = { Loading Loading @@ -190,6 +195,11 @@ trait ElasticClient { execute(s"${target.host}$path", "PUT", Some(settings.toString), target.authentication) } def updateIndexSettings(index: String, settings: JsValue, target: ElasticServer) = { val path = s"/$index/_settings" execute(s"${target.host}$path", "PUT", Some(settings.toString), target.authentication) } def executeRequest(method: String, path: String, data: Option[JsValue], target: ElasticServer) = execute(s"${target.host}/$path", method, data.map(_.toString), target.authentication) Loading conf/routes +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ POST /templates/create @controllers.TemplatesCont POST /cluster_settings @controllers.ClusterSettingsController.getSettings POST /cluster_settings/save @controllers.ClusterSettingsController.save # Index settings module POST /index_settings @controllers.IndexSettingsController.get POST /index_settings/update @controllers.IndexSettingsController.update # Connect module GET /connect/hosts @controllers.ConnectController.index Loading public/index_settings/blocks.html 0 → 100644 +12 −0 Original line number Diff line number Diff line <div class="row form-group"> <div class="col-xs-12"> <h4>block operations</h4> </div> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.read_only'" /> <!-- TODO: boolean --> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.read'" /> <!-- TODO: boolean --> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.write'" /> <!-- TODO: boolean --> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.metadata'" /> <!-- TODO: boolean --> </div> public/index_settings/cache.html 0 → 100644 +10 −0 Original line number Diff line number Diff line <div class="row form-group"> <div class="col-xs-12"> <h4>cache</h4> </div> <cluster-setting settings="settings" set="set(property)" property="'index.fielddata.cache'" /> <cluster-setting settings="settings" set="set(property)" property="'index.queries.cache.enabled'" /> <cluster-setting settings="settings" set="set(property)" property="'index.queries.cache.everything'" /> <cluster-setting settings="settings" set="set(property)" property="'index.requests.cache.enable'" /> </div> Loading
app/controllers/IndexSettingsController.scala 0 → 100644 +22 −0 Original line number Diff line number Diff line package controllers import models.ElasticServer import scala.concurrent.ExecutionContext.Implicits.global class IndexSettingsController extends BaseController { def get = process { (request, client) => client.getIndexSettingsFlat(request.get("index"), ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } def update = process { (request, client) => val index = request.get("index") val settings = request.getObj("settings") client.updateIndexSettings(index, settings, ElasticServer(request.host, request.authentication)).map { response => Status(response.status)(response.body) } } }
app/elastic/ElasticClient.scala +11 −1 Original line number Diff line number Diff line Loading @@ -88,6 +88,11 @@ trait ElasticClient { execute(s"${target.host}$path", "GET", None, target.authentication) } def getIndexSettingsFlat(index: String, target: ElasticServer) = { val path = s"/$index/_settings?flat_settings=true&include_defaults=true" execute(s"${target.host}$path", "GET", None, target.authentication) } def getIndexMapping(index: String, target: ElasticServer) = { val path = s"/$index/_mapping" execute(s"${target.host}$path", "GET", None, target.authentication) Loading Loading @@ -140,7 +145,7 @@ trait ElasticClient { def createIndex(index: String, metadata: JsValue, target: ElasticServer) = { val path = s"/$index" execute(s"${target.host}$path", "POST", Some(metadata.toString), target.authentication) execute(s"${target.host}$path", "PUT", Some(metadata.toString), target.authentication) } def getIndices(target: ElasticServer) = { Loading Loading @@ -190,6 +195,11 @@ trait ElasticClient { execute(s"${target.host}$path", "PUT", Some(settings.toString), target.authentication) } def updateIndexSettings(index: String, settings: JsValue, target: ElasticServer) = { val path = s"/$index/_settings" execute(s"${target.host}$path", "PUT", Some(settings.toString), target.authentication) } def executeRequest(method: String, path: String, data: Option[JsValue], target: ElasticServer) = execute(s"${target.host}/$path", method, data.map(_.toString), target.authentication) Loading
conf/routes +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,10 @@ POST /templates/create @controllers.TemplatesCont POST /cluster_settings @controllers.ClusterSettingsController.getSettings POST /cluster_settings/save @controllers.ClusterSettingsController.save # Index settings module POST /index_settings @controllers.IndexSettingsController.get POST /index_settings/update @controllers.IndexSettingsController.update # Connect module GET /connect/hosts @controllers.ConnectController.index Loading
public/index_settings/blocks.html 0 → 100644 +12 −0 Original line number Diff line number Diff line <div class="row form-group"> <div class="col-xs-12"> <h4>block operations</h4> </div> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.read_only'" /> <!-- TODO: boolean --> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.read'" /> <!-- TODO: boolean --> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.write'" /> <!-- TODO: boolean --> <cluster-setting settings="settings" set="set(property)" property="'index.blocks.metadata'" /> <!-- TODO: boolean --> </div>
public/index_settings/cache.html 0 → 100644 +10 −0 Original line number Diff line number Diff line <div class="row form-group"> <div class="col-xs-12"> <h4>cache</h4> </div> <cluster-setting settings="settings" set="set(property)" property="'index.fielddata.cache'" /> <cluster-setting settings="settings" set="set(property)" property="'index.queries.cache.enabled'" /> <cluster-setting settings="settings" set="set(property)" property="'index.queries.cache.everything'" /> <cluster-setting settings="settings" set="set(property)" property="'index.requests.cache.enable'" /> </div>