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

com.datawizards.esclient.examples.CreateIndex.scala Maven / Gradle / Ivy

The newest version!
package com.datawizards.esclient.examples

import com.datawizards.esclient.repository.ElasticsearchRepositoryImpl

object CreateIndex extends App {
  val repository = new ElasticsearchRepositoryImpl("http://localhost:9200")
  val mapping =
    """{
      |   "mappings" : {
      |      "Person" : {
      |         "properties" : {
      |            "name" : {"type" : "string"},
      |            "age" : {"type" : "integer"}
      |         }
      |      }
      |   }
      |}""".stripMargin

  val indexName = "persontest"
  repository.createIndex(indexName, mapping)
  println(repository.getIndexSettings(indexName))
  println(repository.indexExists(indexName))
  println(repository.deleteIndex(indexName))
  println(repository.indexExists(indexName))
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy