Any way for an Elasticsearch plugin to override default api behavior?

Hi,

I'm playing around with Elastic, and wondered if there's anyway to dynamically override a default endpoint behavior.

I tried creating a plugin which adds a BaseRestHandler, but when attempting to specify a route which was already used, the node failed to start with an exception, claiming it's already taken.

Looking into the code this seems to be intended, but I wandered if there's anything I'm missing.

Thanks :slight_smile:

Btw, I'm building the plugin with the following gradle.build file, if there's something I'm missing out here:

import java.nio.file.Files

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath "org.elasticsearch.gradle:build-tools:${elasticsearchVersion}"
    }
}

group = 'com.dor.tests'
version = "${pluginVersion}.es.${elasticsearchVersion}-SNAPSHOT"

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.yaml-rest-test'
apply plugin: 'elasticsearch.testclusters'

licenseFile = rootProject.file('LICENSE')
noticeFile = rootProject.file('NOTICE')

processResources {
    filesMatching("**/plugin.properties") {
        expand(project.properties)
    }
}

esplugin {
  licenseFile rootProject.file('LICENSE')
  noticeFile rootProject.file('NOTICE')

  name pluginName
  description pluginDesc
  classname pluginClassname
}

validateNebulaPom.enabled = false

dependencies {
  compile "com.fasterxml.jackson.core:jackson-databind:${jacksonDataBindVersion}"
}

testClusters.matching { it.name == "runTask" }.configureEach {
  testDistribution = 'DEFAULT'
}

This is indeed on purpose. Please create a new endpoint that implements your custom behaviour.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.