Skip to content

Commit 88b7f63

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/integration-tests
2 parents 9e72294 + 0796804 commit 88b7f63

36 files changed

+812
-249
lines changed

.editorconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ dotnet_diagnostic.IDE0305.severity = none
246246
# CS8509 already warns
247247
dotnet_diagnostic.IDE0072.severity = none
248248

249-
249+
[src/api/Elastic.Documentation.Api.Lambda/**.cs]
250+
dotnet_diagnostic.IL3050.severity = none
251+
dotnet_diagnostic.IL2026.severity = none
250252

251253
[DocumentationWebHost.cs]
252254
dotnet_diagnostic.IL3050.severity = none
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
# This workflow is used to build the API lambda
3+
# lambda function bootstrap binary that can be deployed to AWS Lambda.
4+
name: Build API Lambda
5+
6+
on:
7+
workflow_dispatch:
8+
workflow_call:
9+
inputs:
10+
ref:
11+
required: false
12+
type: string
13+
default: ${{ github.ref }}
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
env:
19+
BINARY_PATH: .artifacts/Elastic.Documentation.Api.Lambda/release_linux-x64/bootstrap
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
ref: ${{ inputs.ref }}
24+
- name: Amazon Linux 2023 build
25+
run: |
26+
docker build . -t api-lambda:latest -f src/api/Elastic.Documentation.Api.Lambda/Dockerfile
27+
- name: Get bootstrap binary
28+
run: |
29+
docker cp $(docker create --name tc api-lambda:latest):/app/.artifacts/publish ./.artifacts && docker rm tc
30+
- name: Inspect bootstrap binary
31+
run: |
32+
tree .artifacts
33+
stat "${BINARY_PATH}"
34+
- name: Archive artifact
35+
id: upload-artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: api-lambda-binary
39+
retention-days: 1
40+
if-no-files-found: error
41+
path: ${{ env.BINARY_PATH }}

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ jobs:
3232
- name: Validate Content Sources
3333
run: dotnet run --project src/tooling/docs-assembler -c release -- content-source validate
3434

35-
build-lambda:
35+
build-link-index-updater-lambda:
3636
uses: ./.github/workflows/build-link-index-updater-lambda.yml
37-
37+
38+
build-api-lambda:
39+
uses: ./.github/workflows/build-api-lambda.yml
40+
3841
npm:
3942
runs-on: ubuntu-latest
4043
defaults:
@@ -81,6 +84,9 @@ jobs:
8184
id: bootstrap
8285
uses: ./.github/actions/bootstrap
8386

87+
- name: Install Aspire workload
88+
run: dotnet workload install aspire
89+
8490
- name: Build
8591
run: dotnet run --project build -c release
8692

Directory.Packages.props

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</ItemGroup>
1212
<!-- AWS -->
1313
<ItemGroup>
14+
<PackageVersion Include="Amazon.Lambda.AspNetCoreServer.Hosting" Version="1.9.0" />
1415
<PackageVersion Include="Amazon.Lambda.RuntimeSupport" Version="1.13.0" />
1516
<PackageVersion Include="Amazon.Lambda.Core" Version="2.5.1" />
1617
<PackageVersion Include="Amazon.Lambda.S3Events" Version="3.1.0" />
@@ -25,6 +26,7 @@
2526
<PackageVersion Include="FakeItEasy" Version="8.3.0" />
2627
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.11.3" />
2728
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" />
29+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.4" />
2830
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
2931
<PackageVersion Include="System.Text.Json" Version="9.0.5" />
3032
<PackageVersion Include="TUnit" Version="0.25.21" />
@@ -90,4 +92,4 @@
9092
</PackageVersion>
9193
<PackageVersion Include="xunit.v3" Version="2.0.2" />
9294
</ItemGroup>
93-
</Project>
95+
</Project>

docs-builder.sln

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Aspir
133133
EndProject
134134
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.ServiceDefaults", "src\Elastic.Documentation.ServiceDefaults\Elastic.Documentation.ServiceDefaults.csproj", "{2A83ED35-B631-4F02-8D4C-15611D0DB72C}"
135135
EndProject
136+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{B042CC78-5060-4091-B95A-79C71BA3908A}"
137+
EndProject
138+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Api.Core", "src\api\Elastic.Documentation.Api.Core\Elastic.Documentation.Api.Core.csproj", "{F30B90AD-1A01-4A6F-9699-809FA6875B22}"
139+
EndProject
140+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Api.Infrastructure", "src\api\Elastic.Documentation.Api.Infrastructure\Elastic.Documentation.Api.Infrastructure.csproj", "{AE3FC78E-167F-4B6E-88EC-84743EB748B7}"
141+
EndProject
142+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Api.Lambda", "src\api\Elastic.Documentation.Api.Lambda\Elastic.Documentation.Api.Lambda.csproj", "{C6A121C5-DEB1-4FCE-9140-AF144EA98EEE}"
143+
EndProject
136144
Global
137145
GlobalSection(SolutionConfigurationPlatforms) = preSolution
138146
Debug|Any CPU = Debug|Any CPU
@@ -230,6 +238,18 @@ Global
230238
{2A83ED35-B631-4F02-8D4C-15611D0DB72C}.Debug|Any CPU.Build.0 = Debug|Any CPU
231239
{2A83ED35-B631-4F02-8D4C-15611D0DB72C}.Release|Any CPU.ActiveCfg = Release|Any CPU
232240
{2A83ED35-B631-4F02-8D4C-15611D0DB72C}.Release|Any CPU.Build.0 = Release|Any CPU
241+
{F30B90AD-1A01-4A6F-9699-809FA6875B22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
242+
{F30B90AD-1A01-4A6F-9699-809FA6875B22}.Debug|Any CPU.Build.0 = Debug|Any CPU
243+
{F30B90AD-1A01-4A6F-9699-809FA6875B22}.Release|Any CPU.ActiveCfg = Release|Any CPU
244+
{F30B90AD-1A01-4A6F-9699-809FA6875B22}.Release|Any CPU.Build.0 = Release|Any CPU
245+
{AE3FC78E-167F-4B6E-88EC-84743EB748B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
246+
{AE3FC78E-167F-4B6E-88EC-84743EB748B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
247+
{AE3FC78E-167F-4B6E-88EC-84743EB748B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
248+
{AE3FC78E-167F-4B6E-88EC-84743EB748B7}.Release|Any CPU.Build.0 = Release|Any CPU
249+
{C6A121C5-DEB1-4FCE-9140-AF144EA98EEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
250+
{C6A121C5-DEB1-4FCE-9140-AF144EA98EEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
251+
{C6A121C5-DEB1-4FCE-9140-AF144EA98EEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
252+
{C6A121C5-DEB1-4FCE-9140-AF144EA98EEE}.Release|Any CPU.Build.0 = Release|Any CPU
233253
EndGlobalSection
234254
GlobalSection(NestedProjects) = preSolution
235255
{4D198E25-C211-41DC-9E84-B15E89BD7048} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A}
@@ -263,5 +283,9 @@ Global
263283
{A272D3EC-FAAF-4795-A796-302725382AFF} = {BCAD38D5-6C83-46E2-8398-4BE463931098}
264284
{4DFECE72-4A1F-4B58-918E-DCD07B585231} = {BCAD38D5-6C83-46E2-8398-4BE463931098}
265285
{2A83ED35-B631-4F02-8D4C-15611D0DB72C} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A}
286+
{B042CC78-5060-4091-B95A-79C71BA3908A} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A}
287+
{F30B90AD-1A01-4A6F-9699-809FA6875B22} = {B042CC78-5060-4091-B95A-79C71BA3908A}
288+
{AE3FC78E-167F-4B6E-88EC-84743EB748B7} = {B042CC78-5060-4091-B95A-79C71BA3908A}
289+
{C6A121C5-DEB1-4FCE-9140-AF144EA98EEE} = {B042CC78-5060-4091-B95A-79C71BA3908A}
266290
EndGlobalSection
267291
EndGlobal

src/Elastic.Documentation.Site/Assets/dismissible-banner.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Elastic.Documentation.Site/Assets/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { initCopyButton } from './copybutton'
2-
import { initDismissibleBanner } from './dismissible-banner'
32
import { initHighlight } from './hljs'
43
import { initImageCarousel } from './image-carousel'
54
import './markdown/applies-to'
@@ -33,7 +32,6 @@ document.addEventListener('htmx:load', function (event) {
3332
}
3433
initSmoothScroll()
3534
openDetailsWithAnchor()
36-
initDismissibleBanner()
3735
initImageCarousel()
3836

3937
const urlParams = new URLSearchParams(window.location.search)

src/Elastic.Documentation.Site/Assets/styles.css

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,6 @@ body {
215215
display: none;
216216
}
217217

218-
#dismissible-banner {
219-
@apply font-body sticky bottom-0 z-50 mt-0 hidden flex-row items-center justify-between p-4 text-sm;
220-
}
221-
222-
#dismissible-button {
223-
@apply text-blue-developer cursor-pointer text-base font-bold;
224-
&:hover {
225-
@apply bg-grey-20 rounded-2xl;
226-
}
227-
}
228-
229218
.tippy-content {
230219
white-space: pre-line;
231220
}

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/useLlmGateway.ts

Lines changed: 12 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,12 @@ import { EventSourceMessage } from '@microsoft/fetch-event-source'
44
import { useEffect, useState, useRef, useCallback } from 'react'
55
import * as z from 'zod'
66

7-
export const LlmGatewayRequestSchema = z.object({
8-
userContext: z.object({
9-
userEmail: z.string(),
10-
}),
11-
platformContext: z.object({
12-
origin: z.literal('support_portal'),
13-
useCase: z.literal('support_assistant'),
14-
metadata: z.any(),
15-
}),
16-
input: z.array(
17-
z.object({
18-
role: z.string(),
19-
message: z.string(),
20-
})
21-
),
22-
threadId: z.string(),
7+
export const AskAiRequestSchema = z.object({
8+
message: z.string(),
9+
threadId: z.string().optional(),
2310
})
2411

25-
export type LlmGatewayRequest = z.infer<typeof LlmGatewayRequestSchema>
12+
export type AskAiRequest = z.infer<typeof AskAiRequestSchema>
2613

2714
const sharedAttributes = {
2815
timestamp: z.number(),
@@ -154,8 +141,8 @@ export const useLlmGateway = (props: Props): UseLlmGatewayResponse => {
154141
[processMessage]
155142
)
156143

157-
const { sendMessage, abort } = useFetchEventSource<LlmGatewayRequest>({
158-
apiEndpoint: '/chat',
144+
const { sendMessage, abort } = useFetchEventSource<AskAiRequest>({
145+
apiEndpoint: '/_api/v1/ask-ai/stream',
159146
onMessage,
160147
onError: (error) => {
161148
setError(error)
@@ -221,64 +208,12 @@ export const useLlmGateway = (props: Props): UseLlmGatewayResponse => {
221208
}
222209
}
223210

224-
function createLlmGatewayRequest(question: string, threadId?: string) {
225-
// TODO: we should move this to the backend so that the use cannot change this
226-
// Right now, the backend is a pure proxy to the LLM gateway
227-
return LlmGatewayRequestSchema.parse({
228-
userContext: {
229-
userEmail: `elastic-docs-v3@invalid`, // Random email (will be optional in the future)
230-
},
231-
platformContext: {
232-
origin: 'support_portal',
233-
useCase: 'support_assistant',
234-
metadata: {},
235-
},
236-
input: [
237-
{
238-
role: 'user',
239-
message: `
240-
# ROLE AND GOAL
241-
You are an expert AI assistant for the Elastic Stack (Elasticsearch, Kibana, Beats, Logstash, etc.). Your sole purpose is to answer user questions based *exclusively* on the provided context from the official Elastic Documentation.
242-
243-
# CRITICAL INSTRUCTION: SINGLE-SHOT INTERACTION
244-
This is a single-turn interaction. The user cannot reply to your answer for clarification. Therefore, your response MUST be final, self-contained, and as comprehensive as possible based on the provided context.
245-
Also, keep the response as short as possible, but do not truncate the context.
246-
247-
# RULES
248-
1. **Facts** Always do RAG search to find the relevant Elastic documentation.
249-
2. **Strictly Grounded Answers:** You MUST base your answer 100% on the information from the search results. Do not use any of your pre-trained knowledge or any information outside of this context.
250-
3. **Handle Ambiguity Gracefully:** Since you cannot ask clarifying questions, if the question is broad or ambiguous (e.g., "how to improve performance"), structure your answer to cover the different interpretations supported by the context.
251-
* Acknowledge the ambiguity. For example: "Your question about 'performance' can cover several areas. Based on the documentation, here are the key aspects:"
252-
* Organize the answer with clear headings for each aspect (e.g., "Indexing Performance," "Query Performance").
253-
* But if there is a similar or related topic in the docs you can mention it and link to it.
254-
4. **Direct Answer First:** If the context directly and sufficiently answers a specific question, provide a clear, comprehensive, and well-structured answer.
255-
* Use Markdown for formatting (e.g., code blocks for configurations, bullet points for lists).
256-
* Use LaTeX for mathematical or scientific notations where appropriate (e.g., \`$E = mc^2$\`).
257-
* Make the answer as complete as possible, as this is the user's only response.
258-
* Keep the answer short and concise. We want to link users to the Elastic Documentation to find more information.
259-
5. **Handling Incomplete Answers:** If the context contains relevant information but does not fully answer the question, you MUST follow this procedure:
260-
* Start by explicitly stating that you could not find a complete answer.
261-
* Then, summarize the related information you *did* find in the context, explaining how it might be helpful.
262-
6. **Handling No Answer:** If the context is empty or completely irrelevant to the question, you MUST respond with the following, and nothing else:
263-
I was unable to find an answer to your question in the Elastic Documentation.
264-
265-
For further assistance, you may want to:
266-
* Ask the community of experts at **discuss.elastic.co**.
267-
* If you have an Elastic subscription, contact our support engineers at **support.elastic.co**."
268-
7. If you are 100% sure that something is not supported by Elastic, then say so.
269-
8. **Tone:** Your tone should be helpful, professional, and confident. It is better to provide no answer (Rule #5) than an incorrect one.
270-
* Assume that the user is using Elastic for the first time.
271-
* Assume that the user is a beginner.
272-
* Assume that the user has a limited knowledge of Elastic
273-
* Explain unusual terminology, abbreviations, or acronyms.
274-
* Always try to cite relevant Elastic documentation.
275-
`,
276-
},
277-
{
278-
role: 'user',
279-
message: question,
280-
},
281-
],
211+
function createLlmGatewayRequest(
212+
message: string,
213+
threadId?: string
214+
): AskAiRequest {
215+
return AskAiRequestSchema.parse({
216+
message,
282217
threadId,
283218
})
284219
}

src/Elastic.Markdown/Layout/_LandingPage.cshtml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<div class="container mx-auto pt-16 pb-10 grid md:grid-cols-2 items-center gap-6">
1111
<div>
1212
<h1 class="text-4xl font-bold font-sans text-black">Elastic Docs</h1>
13-
<p class="mt-4">Find the help you need, wherever you are in your Elastic journey.</p>
13+
<p class="mt-4">Welcome to the docs that cover all changes in <span class="whitespace-nowrap">Elastic Stack 9.0.0</span> and later, including <span class="whitespace-nowrap">Elastic Stack @Model.CurrentVersion</span> and <span class="whitespace-nowrap">Elastic Cloud Serverless</span>.
14+
For easy reference, changes in 9.1.0 are marked inline. For details, check <a href="https://www.elastic.co/docs/get-started/versioning-availability" class="link">Understanding versioning and availability.</a></p>
1415
<div class="flex md:inline-flex gap-3 mt-6">
1516
<a href="@Model.Link("/get-started/")" class="grow select-none cursor-pointer text-white text-nowrap bg-blue-elastic hover:bg-blue-elastic-110 focus:ring-4 focus:ring-blue-elastic-50 font-semibold font-sans rounded-sm px-6 py-2 focus:outline-none h-10 flex items-center justify-center">
1617
Get started
@@ -53,8 +54,8 @@
5354
<p class="font-sans font-bold text-xl">Elasticsearch</p>
5455
<p class="mt-2 grow">Build powerful search and RAG applications using Elasticsearch's vector database, AI toolkit, and advanced retrieval capabilities.</p>
5556
<div class="grid grid-cols-1 mt-6 gap-2">
56-
<a href="@Model.Link("/solutions/search")" class="text-blue-elastic hover:text-blue-elastic-100 font-sans font-semibold">View @Model.CurrentVersion docs</a>
57-
<a href="https://www.elastic.co/guide/en/elasticsearch/reference/index.html" class="text-sm text-grey-70 hover:text-grey-100 font-sans font-semibold">View other versions</a>
57+
<a href="@Model.Link("/solutions/search")" class="text-blue-elastic hover:text-blue-elastic-100 font-sans font-semibold">9.0+ (latest @Model.CurrentVersion) docs</a>
58+
<a href="https://www.elastic.co/guide/en/elasticsearch/reference/index.html" class="text-sm text-grey-70 hover:text-grey-100 font-sans font-semibold">Previous versions</a>
5859
</div>
5960
</div>
6061
</div>
@@ -66,8 +67,8 @@
6667
<p class="font-sans font-bold text-xl">Observability</p>
6768
<p class="mt-2 grow">Resolve problems with open, flexible, and unified observability powered by advanced machine learning and analytics.</p>
6869
<div class="grid grid-cols-1 mt-6 gap-2">
69-
<a href="@Model.Link("/solutions/observability")" class="text-blue-elastic hover:text-blue-elastic-100 font-sans font-semibold">View @Model.CurrentVersion docs</a>
70-
<a href="https://www.elastic.co/guide/en/observability/index.html" class="text-sm text-grey-70 hover:text-grey-100 font-sans font-semibold">View other versions</a>
70+
<a href="@Model.Link("/solutions/observability")" class="text-blue-elastic hover:text-blue-elastic-100 font-sans font-semibold">9.0+ (latest @Model.CurrentVersion) docs</a>
71+
<a href="https://www.elastic.co/guide/en/observability/index.html" class="text-sm text-grey-70 hover:text-grey-100 font-sans font-semibold">Previous versions</a>
7172
</div>
7273
</div>
7374
</div>
@@ -80,8 +81,8 @@
8081
<p class="font-sans font-bold text-xl">Security</p>
8182
<p class="mt-2 grow">Detect, investigate, and respond to threats with AI-driven security analytics to protect your organization at scale.</p>
8283
<div class="grid grid-cols-1 mt-6 gap-2">
83-
<a href="@Model.Link("/solutions/security")" class="text-blue-elastic hover:text-blue-elastic-100 font-sans font-semibold">View @Model.CurrentVersion docs</a>
84-
<a href="https://www.elastic.co/guide/en/security/index.html" class="text-sm text-grey-70 hover:text-grey-100 font-sans font-semibold">View other versions</a>
84+
<a href="@Model.Link("/solutions/security")" class="text-blue-elastic hover:text-blue-elastic-100 font-sans font-semibold">9.0+ (latest @Model.CurrentVersion) docs</a>
85+
<a href="https://www.elastic.co/guide/en/security/index.html" class="text-sm text-grey-70 hover:text-grey-100 font-sans font-semibold">Previous versions</a>
8586
</div>
8687
</div>
8788
</div>
@@ -224,7 +225,7 @@
224225
<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-4 mt-6 bg-ink-dark text-white">
225226
<div class="flex flex-col p-6">
226227
<h3 class="font-sans font-bold text-2xl">Release notes</h3>
227-
<p class="grow mt-4">Explore the latest features and changes in Elastic.</p>
228+
<p class="grow mt-4">Explore the latest features and changes in Elastic, including the latest 9.1.0 version of the Elastic Stack.</p>
228229
<div class="mt-6">
229230
<a href="@Model.Link("/release-notes/")" class="link text-white">
230231
View release notes

0 commit comments

Comments
 (0)