Skip to content

Commit ec8e0cd

Browse files
Merge branch '7.12' into backport/7.12/pr-92081
2 parents 65114a0 + 20beb97 commit ec8e0cd

17 files changed

Lines changed: 276 additions & 133 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@
7171
"**/cross-fetch/node-fetch": "^2.6.1",
7272
"**/deepmerge": "^4.2.2",
7373
"**/fast-deep-equal": "^3.1.1",
74-
"**/graphql-toolkit/lodash": "^4.17.15",
74+
"**/graphql-toolkit/lodash": "^4.17.21",
7575
"**/hoist-non-react-statics": "^3.3.2",
7676
"**/isomorphic-fetch/node-fetch": "^2.6.1",
7777
"**/istanbul-instrumenter-loader/schema-utils": "1.0.0",
78-
"**/load-grunt-config/lodash": "^4.17.20",
78+
"**/load-grunt-config/lodash": "^4.17.21",
7979
"**/minimist": "^1.2.5",
8080
"**/node-jose/node-forge": "^0.10.0",
8181
"**/prismjs": "1.22.0",
@@ -231,7 +231,7 @@
231231
"json-stringify-safe": "5.0.1",
232232
"jsonwebtoken": "^8.5.1",
233233
"load-json-file": "^6.2.0",
234-
"lodash": "^4.17.20",
234+
"lodash": "^4.17.21",
235235
"lru-cache": "^4.1.5",
236236
"markdown-it": "^10.0.0",
237237
"md5": "^2.1.0",

src/core/server/saved_objects/service/lib/search_dsl/search_dsl.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ describe('getSearchDsl', () => {
9696
mappings,
9797
opts.type,
9898
opts.sortField,
99-
opts.sortOrder,
100-
opts.pit
99+
opts.sortOrder
101100
);
102101
});
103102

src/core/server/saved_objects/service/lib/search_dsl/search_dsl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function getSearchDsl(
7878
hasReferenceOperator,
7979
kueryNode,
8080
}),
81-
...getSortingParams(mappings, type, sortField, sortOrder, pit),
81+
...getSortingParams(mappings, type, sortField, sortOrder),
8282
...(pit ? getPitParams(pit) : {}),
8383
...(searchAfter ? { search_after: searchAfter } : {}),
8484
};

src/core/server/saved_objects/service/lib/search_dsl/sorting_params.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ describe('searchDsl/getSortParams', () => {
7979
],
8080
});
8181
});
82-
it('appends tiebreaker when PIT is provided', () => {
83-
expect(getSortingParams(MAPPINGS, 'saved', 'title', undefined, { id: 'abc' }).sort).toEqual(
84-
expect.arrayContaining([{ _shard_doc: 'asc' }])
85-
);
86-
});
8782
});
8883
describe('sortField is simple root property with multiple types', () => {
8984
it('returns correct params', () => {
@@ -98,11 +93,6 @@ describe('searchDsl/getSortParams', () => {
9893
],
9994
});
10095
});
101-
it('appends tiebreaker when PIT is provided', () => {
102-
expect(
103-
getSortingParams(MAPPINGS, ['saved', 'pending'], 'type', undefined, { id: 'abc' }).sort
104-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
105-
});
10696
});
10797
describe('sortField is simple non-root property with multiple types', () => {
10898
it('returns correct params', () => {
@@ -124,11 +114,6 @@ describe('searchDsl/getSortParams', () => {
124114
],
125115
});
126116
});
127-
it('appends tiebreaker when PIT is provided', () => {
128-
expect(
129-
getSortingParams(MAPPINGS, 'saved', 'title.raw', undefined, { id: 'abc' }).sort
130-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
131-
});
132117
});
133118
describe('sortField is multi-field with single type as array', () => {
134119
it('returns correct params', () => {
@@ -143,11 +128,6 @@ describe('searchDsl/getSortParams', () => {
143128
],
144129
});
145130
});
146-
it('appends tiebreaker when PIT is provided', () => {
147-
expect(
148-
getSortingParams(MAPPINGS, ['saved'], 'title.raw', undefined, { id: 'abc' }).sort
149-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
150-
});
151131
});
152132
describe('sortField is root multi-field with multiple types', () => {
153133
it('returns correct params', () => {
@@ -162,12 +142,6 @@ describe('searchDsl/getSortParams', () => {
162142
],
163143
});
164144
});
165-
it('appends tiebreaker when PIT is provided', () => {
166-
expect(
167-
getSortingParams(MAPPINGS, ['saved', 'pending'], 'type.raw', undefined, { id: 'abc' })
168-
.sort
169-
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
170-
});
171145
});
172146
describe('sortField is not-root multi-field with multiple types', () => {
173147
it('returns correct params', () => {

src/core/server/saved_objects/service/lib/search_dsl/sorting_params.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,14 @@
88

99
import Boom from '@hapi/boom';
1010
import { getProperty, IndexMapping } from '../../../mappings';
11-
import { SavedObjectsPitParams } from '../../../types';
12-
13-
// TODO: The plan is for ES to automatically add this tiebreaker when
14-
// using PIT. We should remove this logic once that is resolved.
15-
// https://github.com/elastic/elasticsearch/issues/56828
16-
const ES_PROVIDED_TIEBREAKER = { _shard_doc: 'asc' };
1711

1812
const TOP_LEVEL_FIELDS = ['_id', '_score'];
1913

2014
export function getSortingParams(
2115
mappings: IndexMapping,
2216
type: string | string[],
2317
sortField?: string,
24-
sortOrder?: string,
25-
pit?: SavedObjectsPitParams
18+
sortOrder?: string
2619
) {
2720
if (!sortField) {
2821
return {};
@@ -38,7 +31,6 @@ export function getSortingParams(
3831
order: sortOrder,
3932
},
4033
},
41-
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
4234
],
4335
};
4436
}
@@ -59,7 +51,6 @@ export function getSortingParams(
5951
unmapped_type: rootField.type,
6052
},
6153
},
62-
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
6354
],
6455
};
6556
}
@@ -84,7 +75,6 @@ export function getSortingParams(
8475
unmapped_type: field.type,
8576
},
8677
},
87-
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
8878
],
8979
};
9080
}

src/plugins/discover/public/application/components/sidebar/lib/field_filter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export function isFieldFiltered(
5959
const scriptedOrMissing =
6060
!filterState.missing ||
6161
field.type === '_source' ||
62+
field.type === 'unknown_selected' ||
6263
field.scripted ||
6364
fieldCounts[field.name] > 0;
6465
const needle = filterState.name ? filterState.name.toLowerCase() : '';

src/plugins/discover/public/application/components/sidebar/lib/group_fields.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,20 @@ describe('group_fields', function () {
217217
]);
218218
});
219219

220+
it('should filter fields by a given name', function () {
221+
const fieldFilterState = { ...getDefaultFieldFilter(), ...{ name: 'curr' } };
222+
223+
const actual1 = groupFields(
224+
fields as IndexPatternField[],
225+
['customer_birth_date', 'currency', 'unknown'],
226+
5,
227+
fieldCounts,
228+
fieldFilterState,
229+
false
230+
);
231+
expect(actual1.selected.map((field) => field.name)).toEqual(['currency']);
232+
});
233+
220234
it('excludes unmapped fields if showUnmappedFields set to false', function () {
221235
const fieldFilterState = getDefaultFieldFilter();
222236
const fieldsWithUnmappedField = [...fields];

src/plugins/discover/public/application/components/sidebar/lib/group_fields.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,18 @@ export function groupFields(
7171
}
7272
}
7373
}
74-
// add columns, that are not part of the index pattern, to be removeable
74+
// add selected columns, that are not part of the index pattern, to be removeable
7575
for (const column of columns) {
76-
if (!result.selected.find((field) => field.name === column)) {
77-
result.selected.push({ name: column, displayName: column } as IndexPatternField);
76+
const tmpField = {
77+
name: column,
78+
displayName: column,
79+
type: 'unknown_selected',
80+
} as IndexPatternField;
81+
if (
82+
!result.selected.find((field) => field.name === column) &&
83+
isFieldFiltered(tmpField, fieldFilterState, fieldCounts)
84+
) {
85+
result.selected.push(tmpField);
7886
}
7987
}
8088
result.selected.sort((a, b) => {

src/plugins/embeddable/README.asciidoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ There is also an example of rendering dashboard container outside of dashboard a
2222

2323
=== Docs
2424

25-
link:./docs/README.md[Embeddable docs, guides & caveats]
25+
link:https://github.com/elastic/kibana/blob/master/src/plugins/embeddable/docs/README.md[Embeddable docs, guides & caveats]
2626

2727
=== API docs
2828

29-
==== Server API
30-
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md[Server Setup contract]
31-
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablestart.md[Server Start contract]
32-
3329
===== Browser API
3430
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablesetup.md[Browser Setup contract]
3531
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestart.md[Browser Start contract]
3632

33+
==== Server API
34+
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md[Server Setup contract]
35+
3736
=== Testing
3837

3938
Run unit tests

x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,29 @@ describe('<EditPolicy />', () => {
477477
component.update();
478478
});
479479

480+
test('serialization', async () => {
481+
httpRequestsMockHelpers.setLoadPolicies([DEFAULT_POLICY]);
482+
await act(async () => {
483+
testBed = await setup();
484+
});
485+
const { component, actions } = testBed;
486+
component.update();
487+
await actions.delete.enablePhase();
488+
await actions.setWaitForSnapshotPolicy('test');
489+
await actions.savePolicy();
490+
const latestRequest = server.requests[server.requests.length - 1];
491+
const entirePolicy = JSON.parse(JSON.parse(latestRequest.requestBody).body);
492+
expect(entirePolicy.phases.delete).toEqual({
493+
min_age: '365d',
494+
actions: {
495+
delete: {},
496+
wait_for_snapshot: {
497+
policy: 'test',
498+
},
499+
},
500+
});
501+
});
502+
480503
test('wait for snapshot policy field should correctly display snapshot policy name', () => {
481504
expect(testBed.find('snapshotPolicyCombobox').prop('data-currentvalue')).toEqual([
482505
{

0 commit comments

Comments
 (0)