mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Surface saved object client 10,000 limitation to UI * Update x-pack/plugins/ingest_manager/server/services/saved_object.ts Co-authored-by: John Schulz <github.com@jfsiii.org> Co-authored-by: John Schulz <github.com@jfsiii.org> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: John Schulz <github.com@jfsiii.org> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
a83d6aa9d1
commit
16d5bbb1b3
8 changed files with 35 additions and 17 deletions
|
@ -13,3 +13,9 @@ export * from './epm';
|
|||
export * from './output';
|
||||
export * from './enrollment_api_key';
|
||||
export * from './settings';
|
||||
|
||||
// TODO: This is the default `index.max_result_window` ES setting, which dictates
|
||||
// the maximum amount of results allowed to be returned from a search. It's possible
|
||||
// for the actual setting to differ from the default. Can we retrieve the real
|
||||
// setting in the future?
|
||||
export const SO_SEARCH_LIMIT = 10000;
|
||||
|
|
|
@ -7,6 +7,7 @@ export {
|
|||
PLUGIN_ID,
|
||||
EPM_API_ROUTES,
|
||||
AGENT_API_ROUTES,
|
||||
SO_SEARCH_LIMIT,
|
||||
AGENT_POLICY_SAVED_OBJECT_TYPE,
|
||||
AGENT_EVENT_SAVED_OBJECT_TYPE,
|
||||
AGENT_SAVED_OBJECT_TYPE,
|
||||
|
|
|
@ -15,7 +15,8 @@ import {
|
|||
EuiIcon,
|
||||
EuiPortal,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { FormattedMessage, FormattedNumber } from '@kbn/i18n/react';
|
||||
import { SO_SEARCH_LIMIT } from '../../../../constants';
|
||||
import { Agent } from '../../../../types';
|
||||
import { AgentReassignAgentPolicyFlyout, AgentUnenrollAgentModal } from '../../components';
|
||||
|
||||
|
@ -153,11 +154,22 @@ export const AgentBulkActions: React.FunctionComponent<{
|
|||
<EuiFlexGroup gutterSize="m" alignItems="center">
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiText size="xs" color="subdued">
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentBulkActions.totalAgents"
|
||||
defaultMessage="Showing {count, plural, one {# agent} other {# agents}}"
|
||||
values={{ count: totalAgents }}
|
||||
/>
|
||||
{totalAgents > SO_SEARCH_LIMIT ? (
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentBulkActions.totalAgentsWithLimit"
|
||||
defaultMessage="Showing {count} of {total} agents"
|
||||
values={{
|
||||
count: <FormattedNumber value={SO_SEARCH_LIMIT} />,
|
||||
total: <FormattedNumber value={totalAgents} />,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentBulkActions.totalAgents"
|
||||
defaultMessage="Showing {count, plural, one {# agent} other {# agents}}"
|
||||
values={{ count: totalAgents }}
|
||||
/>
|
||||
)}
|
||||
</EuiText>
|
||||
</EuiFlexItem>
|
||||
{(selectionMode === 'manual' && selectedAgents.length) ||
|
||||
|
@ -184,7 +196,7 @@ export const AgentBulkActions: React.FunctionComponent<{
|
|||
count:
|
||||
selectionMode === 'manual'
|
||||
? selectedAgents.length
|
||||
: totalAgents - totalInactiveAgents,
|
||||
: Math.min(totalAgents - totalInactiveAgents, SO_SEARCH_LIMIT),
|
||||
}}
|
||||
/>
|
||||
</Button>
|
||||
|
|
|
@ -8,6 +8,7 @@ import React, { useState, useEffect } from 'react';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { EuiSelect, EuiSpacer, EuiText, EuiButtonEmpty } from '@elastic/eui';
|
||||
import { SO_SEARCH_LIMIT } from '../../../../constants';
|
||||
import { AgentPolicy, GetEnrollmentAPIKeysResponse } from '../../../../types';
|
||||
import { sendGetEnrollmentAPIKeys, useCore } from '../../../../hooks';
|
||||
import { AgentPolicyPackageBadges } from '../agent_policy_package_badges';
|
||||
|
@ -98,7 +99,7 @@ export const EnrollmentStepAgentPolicy: React.FC<Props> = (props) => {
|
|||
try {
|
||||
const res = await sendGetEnrollmentAPIKeys({
|
||||
page: 1,
|
||||
perPage: 10000,
|
||||
perPage: SO_SEARCH_LIMIT,
|
||||
});
|
||||
if (res.error) {
|
||||
throw res.error;
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { OverviewPanel } from './overview_panel';
|
||||
import { OverviewStats } from './overview_stats';
|
||||
import { SO_SEARCH_LIMIT } from '../../../constants';
|
||||
import { useLink, useGetPackagePolicies } from '../../../hooks';
|
||||
import { AgentPolicy } from '../../../types';
|
||||
import { Loading } from '../../fleet/components';
|
||||
|
@ -25,7 +26,7 @@ export const OverviewPolicySection: React.FC<{ agentPolicies: AgentPolicy[] }> =
|
|||
const { getHref } = useLink();
|
||||
const packagePoliciesRequest = useGetPackagePolicies({
|
||||
page: 1,
|
||||
perPage: 10000,
|
||||
perPage: SO_SEARCH_LIMIT,
|
||||
});
|
||||
|
||||
return (
|
||||
|
|
|
@ -31,6 +31,7 @@ export {
|
|||
SETTINGS_API_ROUTES,
|
||||
APP_API_ROUTES,
|
||||
// Saved object types
|
||||
SO_SEARCH_LIMIT,
|
||||
AGENT_SAVED_OBJECT_TYPE,
|
||||
AGENT_EVENT_SAVED_OBJECT_TYPE,
|
||||
AGENT_ACTION_SAVED_OBJECT_TYPE,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { SavedObjectsClientContract, SavedObjectsFindResponse } from 'src/core/server';
|
||||
import { SO_SEARCH_LIMIT } from '../constants';
|
||||
import { ListWithKuery } from '../types';
|
||||
|
||||
/**
|
||||
|
@ -40,19 +41,13 @@ export const findAllSOs = async <T = unknown>(
|
|||
const { type, sortField, sortOrder, kuery } = options;
|
||||
let savedObjectResults: SavedObjectsFindResponse<T>['saved_objects'] = [];
|
||||
|
||||
// TODO: This is the default `index.max_result_window` ES setting, which dictates
|
||||
// the maximum amount of results allowed to be returned from a search. It's possible
|
||||
// for the actual setting to differ from the default. Can we retrieve the real
|
||||
// setting in the future?
|
||||
const searchLimit = 10000;
|
||||
|
||||
const query = {
|
||||
type,
|
||||
sortField,
|
||||
sortOrder,
|
||||
filter: kuery,
|
||||
page: 1,
|
||||
perPage: searchLimit,
|
||||
perPage: SO_SEARCH_LIMIT,
|
||||
};
|
||||
|
||||
const { saved_objects: initialSOs, total } = await soClient.find<T>(query);
|
||||
|
|
|
@ -22,6 +22,7 @@ import {
|
|||
Output,
|
||||
DEFAULT_AGENT_POLICIES_PACKAGES,
|
||||
} from '../../common';
|
||||
import { SO_SEARCH_LIMIT } from '../constants';
|
||||
import { getPackageInfo } from './epm/packages';
|
||||
import { packagePolicyService } from './package_policy';
|
||||
import { generateEnrollmentAPIKey } from './api_keys';
|
||||
|
@ -159,7 +160,7 @@ export async function setupFleet(
|
|||
});
|
||||
|
||||
const { items: agentPolicies } = await agentPolicyService.list(soClient, {
|
||||
perPage: 10000,
|
||||
perPage: SO_SEARCH_LIMIT,
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue