Skip to content
Draft
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f2605af
Adding todos
jonathan-buttner Sep 19, 2025
b0c82e5
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-c…
jonathan-buttner Sep 25, 2025
4750b48
Starting changes
jonathan-buttner Sep 26, 2025
08a13bd
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-c…
jonathan-buttner Oct 2, 2025
a009e36
Creating conversion functionality
jonathan-buttner Oct 3, 2025
e44d200
Trying to figure out bug
jonathan-buttner Oct 6, 2025
5e5e17e
Starting test changes
jonathan-buttner Oct 7, 2025
b4b80a4
Test changes
jonathan-buttner Oct 7, 2025
e6eed4f
[CI] Auto commit changes from spotless
Oct 8, 2025
5d1ef9c
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-c…
jonathan-buttner Oct 8, 2025
5fbb740
Adding more tests
jonathan-buttner Oct 8, 2025
4168fb5
Merge branch 'ml-eis-call-model-reg' of github.com:jonathan-buttner/e…
jonathan-buttner Oct 8, 2025
b29d60d
[CI] Auto commit changes from spotless
Oct 8, 2025
92b79e0
Removing unnecessary files
jonathan-buttner Oct 8, 2025
ba620e3
Merge branch 'ml-eis-call-model-reg' of github.com:jonathan-buttner/e…
jonathan-buttner Oct 8, 2025
7db8baf
Fixing tests
jonathan-buttner Oct 9, 2025
5db2279
Adding some comments
jonathan-buttner Oct 9, 2025
407788f
Merge branch 'main' of github.com:elastic/elasticsearch into ml-eis-c…
jonathan-buttner Oct 9, 2025
2314635
Adding more comments and tests
jonathan-buttner Oct 9, 2025
e390213
Trying to fix yaml tests
jonathan-buttner Oct 9, 2025
d4a1a03
Adding requirement on contains
jonathan-buttner Oct 9, 2025
4dfbcd5
Adding test for unauthorized model
jonathan-buttner Oct 9, 2025
028ea33
Switching tests for error message change
jonathan-buttner Oct 9, 2025
11b5e3c
Adding compatability library
jonathan-buttner Oct 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.elasticsearch.client.Request;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xpack.esql.AssertWarnings;
Expand Down Expand Up @@ -61,13 +62,15 @@ public void testWithMultipleInferenceIds() throws IOException {
public void testWithInferenceNotConfigured() {
assumeTrue("semantic text capability not available", EsqlCapabilities.Cap.SEMANTIC_TEXT_FIELD_CAPS.isEnabled());

String query = """
from test-semantic3
var inferenceId = "test-semantic3";

String query = Strings.format("""
from %s
| where match(semantic_text_field, "something")
""";
""", inferenceId);
ResponseException re = expectThrows(ResponseException.class, () -> runEsqlQuery(query));

assertThat(re.getMessage(), containsString("Inference endpoint not found"));
assertThat(re.getMessage(), containsString(Strings.format("Inference endpoint [%s] not found", inferenceId)));
assertEquals(404, re.getResponse().getStatusLine().getStatusCode());
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

package org.elasticsearch.xpack.inference.integration;

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.inference.Model;
import org.elasticsearch.inference.TaskType;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.reindex.ReindexPlugin;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.test.http.MockWebServer;
import org.elasticsearch.xpack.inference.LocalStateInferencePlugin;
import org.elasticsearch.xpack.inference.registry.ModelRegistry;
import org.elasticsearch.xpack.inference.registry.ModelRegistryTests;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;

import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.TimeUnit;

import static org.elasticsearch.xpack.inference.external.http.Utils.getUrl;
import static org.elasticsearch.xpack.inference.integration.ModelRegistryIT.createModel;
import static org.elasticsearch.xpack.inference.services.elastic.ElasticInferenceServiceSettings.ELASTIC_INFERENCE_SERVICE_URL;

public class ModelRegistryEisBase extends ESSingleNodeTestCase {
protected static final TimeValue TIMEOUT = new TimeValue(30, TimeUnit.SECONDS);
protected static final MockWebServer webServer = new MockWebServer();

protected ModelRegistry modelRegistry;
private String eisUrl;

public ModelRegistryEisBase() {}

public ModelRegistryEisBase(String eisUrl) {
this.eisUrl = eisUrl;
}

@BeforeClass
public static void init() throws Exception {
webServer.start();
}

@AfterClass
public static void shutdown() {
webServer.close();
}

@Before
public void createComponents() {
modelRegistry = node().injector().getInstance(ModelRegistry.class);
modelRegistry.clearDefaultIds();
}

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return pluginList(ReindexPlugin.class, LocalStateInferencePlugin.class);
}

@Override
protected Settings nodeSettings() {
return Settings.builder().put(super.nodeSettings()).put(ELASTIC_INFERENCE_SERVICE_URL.getKey(), getEisUrl()).build();
}

private String getEisUrl() {
return eisUrl != null ? eisUrl : getUrl(webServer);
}

protected void initializeModels() {
var service = "foo";
var sparseAndTextEmbeddingModels = new ArrayList<Model>();
sparseAndTextEmbeddingModels.add(createModel("sparse-1", TaskType.SPARSE_EMBEDDING, service));
sparseAndTextEmbeddingModels.add(createModel("sparse-2", TaskType.SPARSE_EMBEDDING, service));
sparseAndTextEmbeddingModels.add(createModel("sparse-3", TaskType.SPARSE_EMBEDDING, service));
sparseAndTextEmbeddingModels.add(createModel("embedding-1", TaskType.TEXT_EMBEDDING, service));
sparseAndTextEmbeddingModels.add(createModel("embedding-2", TaskType.TEXT_EMBEDDING, service));

for (var model : sparseAndTextEmbeddingModels) {
ModelRegistryTests.assertStoreModel(modelRegistry, model);
}
}
}
Loading