org.elasticsearch.painless.PainlessPlugin Java Examples

The following examples show how to use org.elasticsearch.painless.PainlessPlugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmbeddedElasticsearchServer.java    From fast-elasticsearch-vector-scoring with Apache License 2.0 6 votes vote down vote up
private void startNodeInAvailablePort(Settings.Builder settings) throws NodeValidationException {
    int findFreePortRetries = MAX_PORT_RETRIES;
    boolean success = false;

    while(!success) {
        try {
            settings.put("http.port", String.valueOf(this.port));

            // this a hack in order to load Groovy plug in since we want to enable the usage of scripts
            node = new NodeExt(settings.build() , Arrays.asList(Netty3Plugin.class, PainlessPlugin.class, ReindexPlugin.class, VectorScoringPlugin.class));
            node.start();
            success = true;
            System.out.println(EmbeddedElasticsearchServer.class.getName() + ": Using port: " + this.port);
        } catch (BindHttpException exception) {
            if(findFreePortRetries == 0) {
                System.out.println("Could not find any free port in range: [" + (this.port - MAX_PORT_RETRIES) + " - " + this.port+"]");
                throw exception;
            }
            findFreePortRetries--;
            System.out.println("Port already in use (" + this.port + "). Trying another port...");
            this.port = randomPort();
        }
    }
}
 
Example #2
Source File: EsEmbeddedServer.java    From datashare with GNU Affero General Public License v3.0 6 votes vote down vote up
public EsEmbeddedServer(String clusterName, String homePath, String dataPath, String httpPort) {
    Settings settings = Settings.builder()
            .put("transport.type", "netty4")
            .put("http.type", "netty4")
            .put("path.home", homePath)
            .put("path.data", dataPath)
            .put("http.port", httpPort)
            .put("cluster.name", clusterName).build();

    node = new PluginConfigurableNode(settings, asList(
            Netty4Plugin.class,
            ParentJoinPlugin.class,
            CommonAnalysisPlugin.class,
            PainlessPlugin.class,
            ReindexPlugin.class
    ));
}
 
Example #3
Source File: LocalNode.java    From core-ng-project with Apache License 2.0 5 votes vote down vote up
private static List<Class<? extends Plugin>> plugins() {
    return List.of(ReindexPlugin.class,
            Netty4Plugin.class,
            MapperExtrasPlugin.class,  // for scaled_float type
            PainlessPlugin.class,
            CommonAnalysisPlugin.class);  // for stemmer analysis
}
 
Example #4
Source File: EmbeddedElasticsearchNode.java    From Quicksql with MIT License 4 votes vote down vote up
/**
 * Creates an instance with existing settings
 * @param settings configuration parameters of ES instance
 * @return instance which needs to be explicitly started (using {@link #start()})
 */
private static EmbeddedElasticsearchNode create(Settings settings) {
  // ensure PainlessPlugin is installed or otherwise scripted fields would not work
  Node node = new LocalNode(settings, Arrays.asList(Netty4Plugin.class, PainlessPlugin.class));
  return new EmbeddedElasticsearchNode(node);
}
 
Example #5
Source File: Sql4EsBase.java    From sql4es with Apache License 2.0 4 votes vote down vote up
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
	return Arrays.asList(Netty4Plugin.class, PainlessPlugin.class);
}
 
Example #6
Source File: EmbeddedElasticsearchNode.java    From calcite with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an instance with existing settings
 * @param settings configuration parameters of ES instance
 * @return instance which needs to be explicitly started (using {@link #start()})
 */
private static EmbeddedElasticsearchNode create(Settings settings) {
  // ensure PainlessPlugin is installed or otherwise scripted fields would not work
  Node node = new LocalNode(settings, Arrays.asList(Netty4Plugin.class, PainlessPlugin.class));
  return new EmbeddedElasticsearchNode(node);
}
 
Example #7
Source File: EmbeddedElasticsearchNode.java    From immutables with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an instance with existing settings
 * @param settings configuration parameters of ES instance
 * @return instance which needs to be explicitly started (using {@link #start()})
 */
private static EmbeddedElasticsearchNode create(Settings settings) {
  // ensure PainlessPlugin is installed or otherwise scripted fields would not work
  Node node = new LocalNode(settings, Arrays.asList(Netty4Plugin.class, PainlessPlugin.class, ReindexPlugin.class));
  return new EmbeddedElasticsearchNode(node);
}
 
Example #8
Source File: EmbeddedElasticsearchNode.java    From Quicksql with MIT License 2 votes vote down vote up
/**
 * Creates an instance with existing settings.
 *
 * @param settings configuration parameters of ES instance
 * @return instance which needs to be explicitly started (using {@link #start()})
 */
private static EmbeddedElasticsearchNode create(Settings settings) {
    // ensure PainlessPlugin is installed or otherwise scripted fields would not work
    Node node = new LocalNode(settings, Arrays.asList(Netty4Plugin.class, PainlessPlugin.class));
    return new EmbeddedElasticsearchNode(node);
}