Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Security Assistant] Adds new Knowledge Base Management Settings UI (#192665) #194074

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -4,11 +4,22 @@
"port": "5601",
"basePath": "",
"elasticApiVersion": "1",
"elasticsearch": {
"host": "localhost",
"port": "9200"
},
"auth": {
"username": "elastic",
"password": "changeme"
"admin": {
"username": "elastic",
"password": "changeme"
},
"assistant_all": {
"username": "assistant_all",
"password": "changeme"
}
},
"appContext": {
"management": "%7B%22type%22%3A%22application%22%2C%22name%22%3A%22management%22%2C%22url%22%3A%22%2Fkbn%2Fapp%2Fmanagement%22%2C%22page%22%3A%22%22%7D",
"security": "%7B%22type%22%3A%22application%22%2C%22name%22%3A%22securitySolutionUI%22%2C%22url%22%3A%22%2Fkbn%2Fapp%2Fsecurity%22%7D"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export const KnowledgeBaseResponse = z.object({
success: z.boolean().optional(),
});

export type CreateKnowledgeBaseRequestQuery = z.infer<typeof CreateKnowledgeBaseRequestQuery>;
export const CreateKnowledgeBaseRequestQuery = z.object({
/**
* Optional ELSER modelId to use when setting up the Knowledge Base
*/
modelId: z.string().optional(),
});
export type CreateKnowledgeBaseRequestQueryInput = z.input<typeof CreateKnowledgeBaseRequestQuery>;

export type CreateKnowledgeBaseRequestParams = z.infer<typeof CreateKnowledgeBaseRequestParams>;
export const CreateKnowledgeBaseRequestParams = z.object({
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ paths:
description: The KnowledgeBase `resource` value.
schema:
type: string
- name: modelId
in: query
description: Optional ELSER modelId to use when setting up the Knowledge Base
required: false
schema:
type: string
responses:
200:
description: Indicates a successful call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_b
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.username}} {{auth.password}}
Authorization: Basic {{auth.admin.username}} {{auth.admin.password}}
X-Kbn-Context: {{appContext.security}}

{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,151 @@
### Create Document Entry
### Create Document Entry [Admin] [Private]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.username}} {{auth.password}}
Authorization: Basic {{auth.admin.username}} {{auth.admin.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "document",
"name": "Favorites",
"name": "Document Entry [Admin] [Private]",
"kbResource": "user",
"source": "api",
"required": true,
"text": "My favorite food is Dan Bing"
}

### Create Index Entry
### Create Document Entry [Admin] [Global]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.username}} {{auth.password}}
Authorization: Basic {{auth.admin.username}} {{auth.admin.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "document",
"name": "Document Entry [Admin] [Global]",
"kbResource": "user",
"source": "api",
"required": true,
"text": "My favorite food is pizza",
"users": []
}

### Create Document Entry [Assistant All] [Private]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.assistant_all.username}} {{auth.assistant_all.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "document",
"name": "Document Entry [Assistant All] [Private]",
"kbResource": "user",
"source": "api",
"required": true,
"text": "My favorite food is popcorn"
}

### Create Document Entry [Assistant All] [Global]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.assistant_all.username}} {{auth.assistant_all.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "document",
"name": "Document Entry [Assistant All] [Global]",
"kbResource": "user",
"source": "api",
"required": true,
"text": "My favorite food is peaches",
"users": []
}

### Create Index Entry [Admin] [Private]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.admin.username}} {{auth.admin.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "index",
"name": "SpongBotSlackConnector",
"name": "Slackbot-test Index Entry [Admin] [Private]",
"namespace": "default",
"index": "spongbot-slack",
"index": "slackbot-test",
"field": "semantic_text",
"description": "Use this index to search for the user's Slack messages.",
"queryDescription":
"The free text search that the user wants to perform over this dataset. So if asking \"what are my slack messages from last week about failed tests\", the query would be \"A test has failed! failing test failed test\"",
"outputFields": ["author", "text", "timestamp"]
}

### Create Index Entry [Admin] [Global]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.admin.username}} {{auth.admin.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "index",
"name": "Slackbot-test Index Entry [Admin] [Global]",
"namespace": "default",
"index": "slackbot-test",
"field": "semantic_text",
"description": "Use this index to search for the user's Slack messages.",
"queryDescription":
"The free text search that the user wants to perform over this dataset. So if asking \"what are my slack messages from last week about failed tests\", the query would be \"A test has failed! failing test failed test\"",
"inputSchema": [
{
"fieldName": "author",
"fieldType": "string",
"description": "The author of the message. So if asking for recent messages from Stan, you would provide 'Stan' as the author."
}
],
"outputFields": ["author", "text", "timestamp"]
"outputFields": ["author", "text", "timestamp"],
"users": []
}

### Create Index Entry [Assistant All] [Private]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.assistant_all.username}} {{auth.assistant_all.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "index",
"name": "Slackbot-test Index Entry [Assistant All] [Private]",
"namespace": "default",
"index": "slackbot-test",
"field": "semantic_text",
"description": "Use this index to search for the user's Slack messages.",
"queryDescription": "The free text search that the user wants to perform over this dataset. So if asking \"what are my slack messages from last week about failed tests\", the query would be \"A test has failed! failing test failed test\"",
"outputFields": ["author", "text", "timestamp" ]
}

### Create Index Entry [Assistant All] [Global]
POST http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries
kbn-xsrf: "true"
Content-Type: application/json
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.assistant_all.username}} {{auth.assistant_all.password}}
X-Kbn-Context: {{appContext.security}}

{
"type": "index",
"name": "Slackbot-test Index Entry [Assistant All] [Global]",
"namespace": "default",
"index": "slackbot-test",
"field": "semantic_text",
"description": "Use this index to search for the user's Slack messages.",
"queryDescription": "The free text search that the user wants to perform over this dataset. So if asking \"what are my slack messages from last week about failed tests\", the query would be \"A test has failed! failing test failed test\"",
"outputFields": ["author", "text", "timestamp" ],
"users": []
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Find all knowledge base entries
GET http://{{host}}:{{port}}{{basePath}}/internal/elastic_assistant/knowledge_base/entries/_find
Elastic-Api-Version: {{elasticApiVersion}}
Authorization: Basic {{auth.username}} {{auth.password}}
Authorization: Basic {{auth.admin.username}} {{auth.admin.password}}
X-Kbn-Context: {{appContext.security}}

Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,4 @@ export const indexEntryMock: IndexEntryCreateFields = {
description: "Use this index to search for the user's Slack messages.",
queryDescription:
'The free text search that the user wants to perform over this dataset. So if asking "what are my slack messages from last week about failed tests", the query would be "A test has failed! failing test failed test".',
inputSchema: [
{
fieldName: 'author',
fieldType: 'string',
description:
"The author of the message. So if asking for recent messages from Stan, you would provide 'Stan' as the author.",
},
],
};
Loading