Skip to content

Commit cfdfe22

Browse files
qn895elasticmachinerbrtj
committed
[AI Infra] Fix index names causing incompatible cluster error when product docs are installed with for multiple Inference IDs (elastic#240506)
## Summary This PR fixes a problem where product doc search is not performed correctly when BOTH E5 and ELSER product docs are installed due to incompatible cluster issue. Steps to reproduce on 9.2: - Install product docs for both E5 and ELSER - Go to Observability AI assistant and ask 'Hey can you look up documentation to how to use agent builder' - See that the assistant doesn't return meaningful answer on the new agent builder After: <img width="1381" height="756" alt="Screenshot 2025-10-24 at 13 54 35" src="https://github.com/user-attachments/assets/5db4dce5-3005-4f04-9fe9-9d5d3b0e9d85" /> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Robert Jaszczurek <[email protected]>
1 parent d7c9230 commit cfdfe22

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

x-pack/platform/plugins/shared/ai_infra/product_doc_base/server/services/search/utils/get_indices_for_product_names.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
* 2.0.
66
*/
77

8-
import { productDocIndexPattern, getProductDocIndexName } from '@kbn/product-doc-common';
8+
import { getProductDocIndexName } from '@kbn/product-doc-common';
99
import { getIndicesForProductNames } from './get_indices_for_product_names';
1010
import { defaultInferenceEndpoints } from '@kbn/inference-common';
1111

1212
describe('getIndicesForProductNames', () => {
1313
it('returns the index pattern when product names are not specified', () => {
14-
expect(getIndicesForProductNames(undefined, undefined)).toEqual(productDocIndexPattern);
15-
expect(getIndicesForProductNames([], undefined)).toEqual(productDocIndexPattern);
14+
const allProductNames = [
15+
getProductDocIndexName('kibana'),
16+
getProductDocIndexName('elasticsearch'),
17+
getProductDocIndexName('observability'),
18+
getProductDocIndexName('security'),
19+
];
20+
expect(getIndicesForProductNames(undefined, undefined)).toEqual(allProductNames);
21+
expect(getIndicesForProductNames([], undefined)).toEqual(allProductNames);
1622
});
1723
it('returns individual index names when product names are specified', () => {
1824
expect(getIndicesForProductNames(['kibana', 'elasticsearch'])).toEqual([

x-pack/platform/plugins/shared/ai_infra/product_doc_base/server/services/search/utils/get_indices_for_product_names.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import {
9-
productDocIndexPattern,
109
getProductDocIndexName,
10+
DocumentationProduct,
1111
type ProductName,
1212
} from '@kbn/product-doc-common';
1313

@@ -16,7 +16,11 @@ export const getIndicesForProductNames = (
1616
inferenceId?: string
1717
): string | string[] => {
1818
if (!productNames || !productNames.length) {
19-
return productDocIndexPattern;
19+
return Object.values(DocumentationProduct).map((productName: ProductName) =>
20+
getProductDocIndexName(productName, inferenceId)
21+
);
2022
}
21-
return productNames.map((productName) => getProductDocIndexName(productName, inferenceId));
23+
return productNames.map((productName: ProductName) =>
24+
getProductDocIndexName(productName, inferenceId)
25+
);
2226
};

0 commit comments

Comments
 (0)