Skip to content
Create a gist now

Instantly share code, notes, and snippets.

package utils
import org.elasticsearch.client.Client
import org.elasticsearch.common.settings.ImmutableSettings
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest
import org.elasticsearch.indices.IndexMissingException
object IndexingUtils {
def createMapping(client: Client, indexName: String, indexType: String, mappingFile: String) {
//Submit mappings to index
def createIndex(client: Client, indexName: String, indexFile: String) {
//Create index
//.put("index.refresh_interval", "-1")
def deleteIndex(client: Client, indexName: String) {
//Delete index if it already exists
try {
.delete(new DeleteIndexRequest(indexName)).actionGet()
} catch {
case e: IndexMissingException =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.