mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Discover][Field caps] Align with the ES responses for closed indices (#199717)](https://github.com/elastic/kibana/pull/199717) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2024-11-19T10:42:28Z","message":"[Discover][Field caps] Align with the ES responses for closed indices (#199717)\n\n- Closes: https://github.com/elastic/kibana/issues/199413\r\n- Related: https://github.com/elastic/kibana/pull/199654\r\n- Related ES PR: https://github.com/elastic/elasticsearch/pull/116021\r\n- Related ES PR: https://github.com/elastic/elasticsearch/pull/116656\r\n\r\n## Summary\r\n\r\nThis PR unskips tests and updates the Kibana API to the updated ES\r\nresponses.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"f61c043bf6b00c26a2226537d6d7ad14a1dbc1c9","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-minor"],"title":"[Discover][Field caps] Align with the ES responses for closed indices","number":199717,"url":"https://github.com/elastic/kibana/pull/199717","mergeCommit":{"message":"[Discover][Field caps] Align with the ES responses for closed indices (#199717)\n\n- Closes: https://github.com/elastic/kibana/issues/199413\r\n- Related: https://github.com/elastic/kibana/pull/199654\r\n- Related ES PR: https://github.com/elastic/elasticsearch/pull/116021\r\n- Related ES PR: https://github.com/elastic/elasticsearch/pull/116656\r\n\r\n## Summary\r\n\r\nThis PR unskips tests and updates the Kibana API to the updated ES\r\nresponses.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"f61c043bf6b00c26a2226537d6d7ad14a1dbc1c9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199717","number":199717,"mergeCommit":{"message":"[Discover][Field caps] Align with the ES responses for closed indices (#199717)\n\n- Closes: https://github.com/elastic/kibana/issues/199413\r\n- Related: https://github.com/elastic/kibana/pull/199654\r\n- Related ES PR: https://github.com/elastic/elasticsearch/pull/116021\r\n- Related ES PR: https://github.com/elastic/elasticsearch/pull/116656\r\n\r\n## Summary\r\n\r\nThis PR unskips tests and updates the Kibana API to the updated ES\r\nresponses.\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"f61c043bf6b00c26a2226537d6d7ad14a1dbc1c9"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
parent
b7d06a222e
commit
2bfbf58e0e
2 changed files with 34 additions and 8 deletions
|
@ -94,7 +94,10 @@ export async function callFieldCapsApi(params: FieldCapsApiParams) {
|
|||
);
|
||||
} catch (error) {
|
||||
// return an empty set for closed indices
|
||||
if (error.message.startsWith('cluster_block_exception')) {
|
||||
if (
|
||||
error.message.startsWith('index_closed_exception') ||
|
||||
error.message.startsWith('cluster_block_exception')
|
||||
) {
|
||||
return { body: { indices: [], fields: {} } };
|
||||
}
|
||||
throw convertEsError(indices, error);
|
||||
|
|
|
@ -21,6 +21,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const esArchiver = getService('esArchiver');
|
||||
const supertest = getService('supertest');
|
||||
const esClient = getService('es');
|
||||
const log = getService('log');
|
||||
|
||||
const ensureFieldsAreSorted = (resp: { body: { fields: { name: string } } }) => {
|
||||
expect(resp.body.fields).to.eql(sortBy(resp.body.fields, 'name'));
|
||||
|
@ -80,8 +81,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
},
|
||||
];
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/199413
|
||||
describe.skip('fields_for_wildcard_route response', () => {
|
||||
describe('fields_for_wildcard_route response', () => {
|
||||
before(() =>
|
||||
esArchiver.load('test/api_integration/fixtures/es_archiver/index_patterns/basic_index')
|
||||
);
|
||||
|
@ -240,7 +240,28 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
.expect(404);
|
||||
});
|
||||
|
||||
it('returns 200 when index is closed', async () => {
|
||||
it('returns 200 when index is closed and allow_no_index is true', async () => {
|
||||
const es = getService('es');
|
||||
|
||||
await es.indices.close({ index: 'basic_index' });
|
||||
|
||||
await supertest
|
||||
.get(FIELDS_FOR_WILDCARD_PATH)
|
||||
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
.query({ pattern: 'basic_index', allow_no_index: true })
|
||||
.expect((response) => {
|
||||
if (response.statusCode !== 200) {
|
||||
log.debug(response.body);
|
||||
}
|
||||
})
|
||||
.expect(200, {
|
||||
fields: [],
|
||||
indices: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('returns 404 when index is closed and allow_no_index is false', async () => {
|
||||
const es = getService('es');
|
||||
|
||||
await es.indices.close({ index: 'basic_index' });
|
||||
|
@ -250,10 +271,12 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION_INTERNAL)
|
||||
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
|
||||
.query({ pattern: 'basic_index' })
|
||||
.expect(200, {
|
||||
fields: [],
|
||||
indices: [],
|
||||
});
|
||||
.expect((response) => {
|
||||
if (response.statusCode !== 404) {
|
||||
log.debug(response.body);
|
||||
}
|
||||
})
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('returns empty set when no fields even if meta fields are supplied', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue