diff --git a/x-pack/plugins/search_indices/public/code_examples/javascript.ts b/x-pack/plugins/search_indices/public/code_examples/javascript.ts
index 3e91cb99301a7..a819b973388f4 100644
--- a/x-pack/plugins/search_indices/public/code_examples/javascript.ts
+++ b/x-pack/plugins/search_indices/public/code_examples/javascript.ts
@@ -19,7 +19,7 @@ export const JAVASCRIPT_INFO: CodeLanguage = {
codeBlockLanguage: 'javascript',
};
-const SERVERLESS_INSTALL_CMD = `npm install @elastic/elasticsearch-serverless`;
+const SERVERLESS_INSTALL_CMD = `npm install @elastic/elasticsearch`;
export const JavascriptServerlessCreateIndexExamples: CreateIndexLanguageExamples = {
default: {
@@ -28,7 +28,7 @@ export const JavascriptServerlessCreateIndexExamples: CreateIndexLanguageExample
elasticsearchURL,
apiKey,
indexName,
- }) => `import { Client } from "@elastic/elasticsearch-serverless"
+ }) => `import { Client } from "@elastic/elasticsearch"
const client = new Client({
node: '${elasticsearchURL}',
@@ -47,7 +47,7 @@ client.indices.create({
elasticsearchURL,
apiKey,
indexName,
- }) => `import { Client } from "@elastic/elasticsearch-serverless"
+ }) => `import { Client } from "@elastic/elasticsearch"
const client = new Client({
node: '${elasticsearchURL}',
diff --git a/x-pack/plugins/search_indices/public/code_examples/python.ts b/x-pack/plugins/search_indices/public/code_examples/python.ts
index e41e542456e72..ac405cfecd1e9 100644
--- a/x-pack/plugins/search_indices/public/code_examples/python.ts
+++ b/x-pack/plugins/search_indices/public/code_examples/python.ts
@@ -23,7 +23,7 @@ export const PYTHON_INFO: CodeLanguage = {
codeBlockLanguage: 'python',
};
-const SERVERLESS_PYTHON_INSTALL_CMD = 'pip install elasticsearch-serverless';
+const SERVERLESS_PYTHON_INSTALL_CMD = 'pip install elasticsearch';
export const PythonServerlessCreateIndexExamples: CreateIndexLanguageExamples = {
default: {
@@ -32,7 +32,7 @@ export const PythonServerlessCreateIndexExamples: CreateIndexLanguageExamples =
elasticsearchURL,
apiKey,
indexName,
- }: CodeSnippetParameters) => `from elasticsearch-serverless import Elasticsearch
+ }: CodeSnippetParameters) => `from elasticsearch import Elasticsearch
client = Elasticsearch(
"${elasticsearchURL}",
@@ -49,21 +49,21 @@ client.indices.create(
elasticsearchURL,
apiKey,
indexName,
- }: CodeSnippetParameters) => `from elasticsearch-serverless import Elasticsearch
+ }: CodeSnippetParameters) => `from elasticsearch import Elasticsearch
client = Elasticsearch(
- "${elasticsearchURL}",
- api_key="${apiKey ?? API_KEY_PLACEHOLDER}"
+ "${elasticsearchURL}",
+ api_key="${apiKey ?? API_KEY_PLACEHOLDER}"
)
client.indices.create(
- index="${indexName ?? INDEX_PLACEHOLDER}"
- mappings={
- "properties": {
- "vector": {"type": "dense_vector", "dims": 3 },
- "text": {"type": "text"}
- }
- }
+ index="${indexName ?? INDEX_PLACEHOLDER}",
+ mappings={
+ "properties": {
+ "vector": {"type": "dense_vector", "dims": 3 },
+ "text": {"type": "text"}
+ }
+ }
)`,
},
};
@@ -72,7 +72,7 @@ const serverlessIngestionCommand: IngestCodeSnippetFunction = ({
apiKey,
indexName,
sampleDocument,
-}) => `from elasticsearch-serverless import Elasticsearch, helpers
+}) => `from elasticsearch import Elasticsearch, helpers
client = Elasticsearch(
"${elasticsearchURL}",
@@ -93,25 +93,20 @@ const serverlessUpdateMappingsCommand: IngestCodeSnippetFunction = ({
apiKey,
indexName,
mappingProperties,
-}) => `from elasticsearch-serverless import Elasticsearch
+}) => `from elasticsearch import Elasticsearch
client = Elasticsearch(
-"${elasticsearchURL}",
-api_key="${apiKey ?? API_KEY_PLACEHOLDER}"
+ "${elasticsearchURL}",
+ api_key="${apiKey ?? API_KEY_PLACEHOLDER}"
)
index_name = "${indexName}"
mappings = ${JSON.stringify({ properties: mappingProperties }, null, 4)}
-update_mapping_response = client.indices.put_mapping(index=index_name, body=mappings)
-
-# Print the response
-print(update_mapping_response)
-
-# Verify the mapping
-mapping = client.indices.get_mapping(index=index_name)
-print(mapping)`;
+mapping_response = client.indices.put_mapping(index=index_name, body=mappings)
+print(mapping_response)
+`;
export const PythonServerlessVectorsIngestDataExample: IngestDataCodeDefinition = {
installCommand: SERVERLESS_PYTHON_INSTALL_CMD,
diff --git a/x-pack/plugins/search_indices/public/components/shared/code_sample.tsx b/x-pack/plugins/search_indices/public/components/shared/code_sample.tsx
index 4ddce94d685b0..5b029ee10a779 100644
--- a/x-pack/plugins/search_indices/public/components/shared/code_sample.tsx
+++ b/x-pack/plugins/search_indices/public/components/shared/code_sample.tsx
@@ -44,7 +44,7 @@ export const CodeSample = ({ id, title, language, code, onCodeCopyClick }: CodeS
{title}
-
+
{code}