Skip to content

Commit

Permalink
improving prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Sep 21, 2023
1 parent af8207b commit 3f1d32e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function registerGetDatasetInfoFunction({
description: `Use this function to get information about indices/datasets available and the fields available on them.
providing empty string as index name will retrieve all indices
if index is provided and it doesnt match any indices in elasticsearch list of all indices will be provoded as well
else list of all fields for the given index will be given.
wildcards can be part of index name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,23 @@ export class ObservabilityAIAssistantClient {
};
}

if (indices.length === 0) {
try {
const body = await this.dependencies.esClient.indices.resolveIndex({
name: '*',
expand_wildcards: 'open',
});
indices = body.indices.map((i) => i.name);
} catch (e) {
indices = [];
}

return {
indices,
fields: [],
};
}

const fields = await this.dependencies.dataviews.getFieldsForWildcard({
pattern: index,
});
Expand Down

0 comments on commit 3f1d32e

Please sign in to comment.