Skip to content

Commit

Permalink
[ES client] Rename deprecated params (#115528) (#115789)
Browse files Browse the repository at this point in the history
* filterPath --> filter_path

* ignoreUnavailable --> ignore_unavailable

* ignoreUnavailable --> ignore_unavailable

* trackScores --> track_scores

* trackTotalHits --> track_total_hits

* rollback unnecessary changes

Co-authored-by: Mikhail Shustov <restrry@gmail.com>
  • Loading branch information
kibanamachine and mshustov authored Oct 20, 2021
1 parent 4f0614f commit d71a250
Show file tree
Hide file tree
Showing 104 changed files with 280 additions and 280 deletions.
4 changes: 2 additions & 2 deletions src/plugins/data_views/server/fetcher/lib/es_api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('server/index_patterns/service/lib/es_api', () => {
expect(resp).toBe(football);
});

it('sets ignoreUnavailable and allowNoIndices params', async () => {
it('sets ignore_unavailable and allow_no_indices params', async () => {
const getAlias = sinon.stub();
const callCluster = {
indices: {
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('server/index_patterns/service/lib/es_api', () => {
expect(resp).toBe(football);
});

it('sets ignoreUnavailable, allowNoIndices, and fields params', async () => {
it('sets ignore_unavailable, allow_no_indices, and fields params', async () => {
const fieldCaps = sinon.stub();
const callCluster = {
indices: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('getSavedObjectsCounts', () => {
expect(results).toStrictEqual([]);
expect(esClient.search).toHaveBeenCalledWith({
index: '.kibana',
ignoreUnavailable: true,
filterPath: 'aggregations.types.buckets',
ignore_unavailable: true,
filter_path: 'aggregations.types.buckets',
body: {
size: 0,
query: { match_all: {} },
Expand All @@ -41,8 +41,8 @@ describe('getSavedObjectsCounts', () => {
await getSavedObjectsCounts(esClient, '.kibana');
expect(esClient.search).toHaveBeenCalledWith({
index: '.kibana',
ignoreUnavailable: true,
filterPath: 'aggregations.types.buckets',
ignore_unavailable: true,
filter_path: 'aggregations.types.buckets',
body: {
size: 0,
query: { match_all: {} },
Expand All @@ -56,8 +56,8 @@ describe('getSavedObjectsCounts', () => {
await getSavedObjectsCounts(esClient, '.kibana', ['type_one', 'type_two']);
expect(esClient.search).toHaveBeenCalledWith({
index: '.kibana',
ignoreUnavailable: true,
filterPath: 'aggregations.types.buckets',
ignore_unavailable: true,
filter_path: 'aggregations.types.buckets',
body: {
size: 0,
query: { terms: { type: ['type_one', 'type_two'] } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export async function getSavedObjectsCounts(

const savedObjectCountSearchParams = {
index: kibanaIndex,
ignoreUnavailable: true,
filterPath: 'aggregations.types.buckets',
ignore_unavailable: true,
filter_path: 'aggregations.types.buckets',
body: {
size: 0,
query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ const customElementCollector: TelemetryCollector = async function customElementC
const customElementParams = {
size: 10000,
index: kibanaIndex,
ignoreUnavailable: true,
filterPath: [`hits.hits._source.${CUSTOM_ELEMENT_TYPE}.content`],
ignore_unavailable: true,
filter_path: [`hits.hits._source.${CUSTOM_ELEMENT_TYPE}.content`],
body: { query: { bool: { filter: { term: { type: CUSTOM_ELEMENT_TYPE } } } } },
};

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/canvas/server/collectors/workpad_collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ const workpadCollector: TelemetryCollector = async function (kibanaIndex, esClie
const searchParams = {
size: 10000, // elasticsearch index.max_result_window default value
index: kibanaIndex,
ignoreUnavailable: true,
filterPath: ['hits.hits._source.canvas-workpad', '-hits.hits._source.canvas-workpad.assets'],
ignore_unavailable: true,
filter_path: ['hits.hits._source.canvas-workpad', '-hits.hits._source.canvas-workpad.assets'],
body: { query: { bool: { filter: { term: { type: CANVAS_TYPE } } } } },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter {
};

const esQuery = {
allowNoIndices: true,
allow_no_indices: true,
index: resolvedLogSourceConfiguration.indices,
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
size: size + 1, // Extra one to test if it has more before or after
track_total_hits: false,
Expand Down Expand Up @@ -139,9 +139,9 @@ export class InfraKibanaLogEntriesAdapter implements LogEntriesAdapter {
);

const query = {
allowNoIndices: true,
allow_no_indices: true,
index: resolvedLogSourceConfiguration.indices,
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
aggregations: {
count_by_date: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const checkValidNode = async (
id: string
): Promise<boolean> => {
const params = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
index: indexPattern,
terminateAfter: 1,
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export class InfraElasticsearchSourceStatusAdapter implements InfraSourceStatusA
this.framework
.callWithRequest(requestContext, 'indices.getAlias', {
name: aliasName,
filterPath: '*.settings.index.uuid', // to keep the response size as small as possible
filter_path: '*.settings.index.uuid', // to keep the response size as small as possible
})
.catch(withDefaultIfNotFound<InfraDatabaseGetIndicesResponse>({})),
this.framework
.callWithRequest(requestContext, 'indices.get', {
index: aliasName,
filterPath: '*.settings.index.uuid', // to keep the response size as small as possible
filter_path: '*.settings.index.uuid', // to keep the response size as small as possible
})
.catch(withDefaultIfNotFound<InfraDatabaseGetIndicesResponse>({})),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ export const createLogEntryDatasetsQuery = (
});

const defaultRequestParameters = {
allowNoIndices: true,
ignoreUnavailable: true,
trackScores: false,
trackTotalHits: false,
allow_no_indices: true,
ignore_unavailable: true,
track_scores: false,
track_total_hits: false,
};

const compositeDatasetKeyRT = rt.type({
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/infra/server/lib/infra_ml/queries/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

export const defaultRequestParameters = {
allowNoIndices: true,
ignoreUnavailable: true,
trackScores: false,
trackTotalHits: false,
allow_no_indices: true,
ignore_unavailable: true,
track_scores: false,
track_total_hits: false,
};

export const createJobIdFilters = (jobId: string) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describe('createMetricsHostAnomaliesQuery', () => {
pagination,
})
).toMatchObject({
allowNoIndices: true,
ignoreUnavailable: true,
trackScores: false,
trackTotalHits: false,
allow_no_indices: true,
ignore_unavailable: true,
track_scores: false,
track_total_hits: false,
body: {
query: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describe('createMetricsK8sAnomaliesQuery', () => {
pagination,
})
).toMatchObject({
allowNoIndices: true,
ignoreUnavailable: true,
trackScores: false,
trackTotalHits: false,
allow_no_indices: true,
ignore_unavailable: true,
track_scores: false,
track_total_hits: false,
body: {
query: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

export const defaultRequestParameters = {
allowNoIndices: true,
ignoreUnavailable: true,
trackScores: false,
trackTotalHits: false,
allow_no_indices: true,
ignore_unavailable: true,
track_scores: false,
track_total_hits: false,
};

export const createJobIdFilters = (jobId: string) => [
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/infra/server/lib/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const query = async (
];

const params = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
index: options.indexPattern,
body: {
size: 0,
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/infra/server/lib/sources/has_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { ESSearchClient } from '../metrics/types';
export const hasData = async (index: string, client: ESSearchClient) => {
const params = {
index,
allowNoIndices: true,
allow_no_indices: true,
terminate_after: 1,
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
size: 0,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export const getCloudMetadata = async (
}

const metricQuery = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
index: sourceConfiguration.metricAlias,
body: {
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const getCloudMetricsMetadata = async (
timeRange: { from: number; to: number }
): Promise<InfraCloudMetricsAdapterResponse> => {
const metricQuery = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
index: sourceConfiguration.metricAlias,
body: {
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const getMetricMetadata = async (
): Promise<InfraMetricsAdapterResponse> => {
const fields = findInventoryFields(nodeType, sourceConfiguration.fields);
const metricQuery = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
index: sourceConfiguration.metricAlias,
body: {
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export const getNodeInfo = async (
const fields = findInventoryFields(nodeType, sourceConfiguration.fields);
const timestampField = sourceConfiguration.fields.timestamp;
const params = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
terminateAfter: 1,
index: sourceConfiguration.metricAlias,
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const getPodNodeName = async (
const fields = findInventoryFields(nodeType, sourceConfiguration.fields);
const timestampField = sourceConfiguration.fields.timestamp;
const params = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
terminateAfter: 1,
index: sourceConfiguration.metricAlias,
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const getDatasetForField = async (
timerange: { field: string; to: number; from: number }
) => {
const params = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
terminateAfter: 1,
index: indexPattern,
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const queryTotalGroupings = async (
}

const params = {
allowNoIndices: true,
ignoreUnavailable: true,
allow_no_indices: true,
ignore_unavailable: true,
index: options.indexPattern,
body: {
size: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const calculateMetricInterval = async (
from = options.timerange.to - inventoryModel.metrics.defaultTimeRangeInSeconds * 1000;
}
const query = {
allowNoIndices: true,
allow_no_indices: true,
index: options.indexPattern,
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
query: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export async function getLastRecovery(req: LegacyRequest, esIndexPattern: string
const mbParams = {
index: esIndexPattern,
size,
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
_source: ['elasticsearch.index.recovery', '@timestamp'],
sort: { timestamp: { order: 'desc', unmapped_type: 'long' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export const buildActionsQuery = ({
// const filter = [...createQueryFilterClauses(filterQuery)];

const dslQuery = {
allowNoIndices: true,
allow_no_indices: true,
index: '.fleet-actions',
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
// query: { bool: { filter } },
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export const buildActionDetailsQuery = ({
];

const dslQuery = {
allowNoIndices: true,
allow_no_indices: true,
index: '.fleet-actions',
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
query: { bool: { filter } },
size: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export const buildActionResultsQuery = ({
];

const dslQuery = {
allowNoIndices: true,
allow_no_indices: true,
index: '.fleet-actions-results*',
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
aggs: {
aggs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export const buildAgentsQuery = ({
];

const dslQuery = {
allowNoIndices: true,
allow_no_indices: true,
index: '.fleet-agents',
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
query: {
bool: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export const buildResultsQuery = ({
];

const dslQuery = {
allowNoIndices: true,
allow_no_indices: true,
index: `logs-${OSQUERY_INTEGRATION_NAME}.result*`,
ignoreUnavailable: true,
ignore_unavailable: true,
body: {
aggs: {
count_by_agent_id: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function getReportingUsage(
const reportingIndex = config.get('index');
const params = {
index: `${reportingIndex}-*`,
filterPath: 'aggregations.*.buckets',
filter_path: 'aggregations.*.buckets',
body: {
size: 0,
aggs: {
Expand Down
Loading

0 comments on commit d71a250

Please sign in to comment.