Skip to content

Commit

Permalink
Merge branch 'master' into ilm/fix-which-fields-are-showing-with-ss
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Feb 25, 2021
2 parents 0b48847 + f0838e6 commit 296704e
Show file tree
Hide file tree
Showing 15 changed files with 286 additions and 512 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ describe('getSearchDsl', () => {
mappings,
opts.type,
opts.sortField,
opts.sortOrder,
opts.pit
opts.sortOrder
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function getSearchDsl(
hasReferenceOperator,
kueryNode,
}),
...getSortingParams(mappings, type, sortField, sortOrder, pit),
...getSortingParams(mappings, type, sortField, sortOrder),
...(pit ? getPitParams(pit) : {}),
...(searchAfter ? { search_after: searchAfter } : {}),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ describe('searchDsl/getSortParams', () => {
],
});
});
it('appends tiebreaker when PIT is provided', () => {
expect(getSortingParams(MAPPINGS, 'saved', 'title', undefined, { id: 'abc' }).sort).toEqual(
expect.arrayContaining([{ _shard_doc: 'asc' }])
);
});
});
describe('sortField is simple root property with multiple types', () => {
it('returns correct params', () => {
Expand All @@ -98,11 +93,6 @@ describe('searchDsl/getSortParams', () => {
],
});
});
it('appends tiebreaker when PIT is provided', () => {
expect(
getSortingParams(MAPPINGS, ['saved', 'pending'], 'type', undefined, { id: 'abc' }).sort
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
});
});
describe('sortField is simple non-root property with multiple types', () => {
it('returns correct params', () => {
Expand All @@ -124,11 +114,6 @@ describe('searchDsl/getSortParams', () => {
],
});
});
it('appends tiebreaker when PIT is provided', () => {
expect(
getSortingParams(MAPPINGS, 'saved', 'title.raw', undefined, { id: 'abc' }).sort
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
});
});
describe('sortField is multi-field with single type as array', () => {
it('returns correct params', () => {
Expand All @@ -143,11 +128,6 @@ describe('searchDsl/getSortParams', () => {
],
});
});
it('appends tiebreaker when PIT is provided', () => {
expect(
getSortingParams(MAPPINGS, ['saved'], 'title.raw', undefined, { id: 'abc' }).sort
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
});
});
describe('sortField is root multi-field with multiple types', () => {
it('returns correct params', () => {
Expand All @@ -162,12 +142,6 @@ describe('searchDsl/getSortParams', () => {
],
});
});
it('appends tiebreaker when PIT is provided', () => {
expect(
getSortingParams(MAPPINGS, ['saved', 'pending'], 'type.raw', undefined, { id: 'abc' })
.sort
).toEqual(expect.arrayContaining([{ _shard_doc: 'asc' }]));
});
});
describe('sortField is not-root multi-field with multiple types', () => {
it('returns correct params', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@

import Boom from '@hapi/boom';
import { getProperty, IndexMapping } from '../../../mappings';
import { SavedObjectsPitParams } from '../../../types';

// TODO: The plan is for ES to automatically add this tiebreaker when
// using PIT. We should remove this logic once that is resolved.
// https://github.com/elastic/elasticsearch/issues/56828
const ES_PROVIDED_TIEBREAKER = { _shard_doc: 'asc' };

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

export function getSortingParams(
mappings: IndexMapping,
type: string | string[],
sortField?: string,
sortOrder?: string,
pit?: SavedObjectsPitParams
sortOrder?: string
) {
if (!sortField) {
return {};
Expand All @@ -38,7 +31,6 @@ export function getSortingParams(
order: sortOrder,
},
},
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
],
};
}
Expand All @@ -59,7 +51,6 @@ export function getSortingParams(
unmapped_type: rootField.type,
},
},
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
],
};
}
Expand All @@ -84,7 +75,6 @@ export function getSortingParams(
unmapped_type: field.type,
},
},
...(pit ? [ES_PROVIDED_TIEBREAKER] : []),
],
};
}
9 changes: 4 additions & 5 deletions src/plugins/embeddable/README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ There is also an example of rendering dashboard container outside of dashboard a

=== Docs

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

=== API docs

==== Server API
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md[Server Setup contract]
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablestart.md[Server Start contract]

===== Browser API
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablesetup.md[Browser Setup contract]
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/public/kibana-plugin-plugins-embeddable-public.embeddablestart.md[Browser Start contract]

==== Server API
https://github.com/elastic/kibana/blob/master/docs/development/plugins/embeddable/server/kibana-plugin-plugins-embeddable-server.embeddablesetup.md[Server Setup contract]

=== Testing

Run unit tests
Expand Down
Loading

0 comments on commit 296704e

Please sign in to comment.