mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ML] Add rest_total_hit_as_int where total hits is required (#26421)
This commit is contained in:
parent
6f81bd37db
commit
ae27e83712
9 changed files with 33 additions and 3 deletions
|
@ -319,6 +319,7 @@ export function getTestUrl(job, customUrl) {
|
|||
return new Promise((resolve, reject) => {
|
||||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
rest_total_hits_as_int: true,
|
||||
body
|
||||
})
|
||||
.then((resp) => {
|
||||
|
|
|
@ -430,6 +430,7 @@ function getSearchJsonFromConfig(formConfig) {
|
|||
const json = {
|
||||
index: formConfig.indexPattern.title,
|
||||
size: 0,
|
||||
rest_total_hits_as_int: true,
|
||||
body: {
|
||||
query: {},
|
||||
aggs: {
|
||||
|
|
|
@ -59,6 +59,7 @@ function getForecastsSummary(
|
|||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
size: maxResults,
|
||||
rest_total_hits_as_int: true,
|
||||
body: {
|
||||
query: {
|
||||
bool: {
|
||||
|
@ -352,6 +353,7 @@ function getForecastRequestStats(job, forecastId) {
|
|||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
size: 1,
|
||||
rest_total_hits_as_int: true,
|
||||
body: {
|
||||
query: {
|
||||
bool: {
|
||||
|
|
|
@ -54,6 +54,7 @@ function getJobAuditMessages(fromRange, jobId) {
|
|||
ml.esSearch({
|
||||
index: ML_NOTIFICATION_INDEX_PATTERN,
|
||||
ignore_unavailable: true,
|
||||
rest_total_hits_as_int: true,
|
||||
size: 1000,
|
||||
body:
|
||||
{
|
||||
|
@ -99,6 +100,7 @@ function getAuditMessagesSummary() {
|
|||
ml.esSearch({
|
||||
index: ML_NOTIFICATION_INDEX_PATTERN,
|
||||
ignore_unavailable: true,
|
||||
rest_total_hits_as_int: true,
|
||||
size: 0,
|
||||
body: {
|
||||
query: {
|
||||
|
|
|
@ -765,6 +765,7 @@ function getRecordInfluencers(jobIds, threshold, earliestMs, latestMs, maxResult
|
|||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
size: maxResults !== undefined ? maxResults : 100,
|
||||
rest_total_hits_as_int: true,
|
||||
body: {
|
||||
_source: ['job_id', 'detector_index', 'influencers', 'record_score'],
|
||||
query: {
|
||||
|
@ -887,6 +888,7 @@ function getRecordsForInfluencer(jobIds, influencers, threshold, earliestMs, lat
|
|||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
size: maxResults !== undefined ? maxResults : 100,
|
||||
rest_total_hits_as_int: true,
|
||||
body: {
|
||||
query: {
|
||||
bool: {
|
||||
|
@ -1013,6 +1015,7 @@ function getRecordsForDetector(
|
|||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
size: maxResults !== undefined ? maxResults : 100,
|
||||
rest_total_hits_as_int: true,
|
||||
body: {
|
||||
query: {
|
||||
bool: {
|
||||
|
@ -1116,6 +1119,7 @@ function getRecordsForCriteria(jobIds, criteriaFields, threshold, earliestMs, la
|
|||
|
||||
ml.esSearch({
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
rest_total_hits_as_int: true,
|
||||
size: maxResults !== undefined ? maxResults : 100,
|
||||
body: {
|
||||
query: {
|
||||
|
@ -1351,6 +1355,7 @@ function getEventRateData(
|
|||
|
||||
ml.esSearch({
|
||||
index,
|
||||
rest_total_hits_as_int: true,
|
||||
size: 0,
|
||||
body: {
|
||||
query: {
|
||||
|
|
|
@ -115,7 +115,12 @@ export class DataRecognizer {
|
|||
query: moduleConfig.query
|
||||
};
|
||||
|
||||
const resp = await this.callWithRequest('search', { index, size, body });
|
||||
const resp = await this.callWithRequest('search', {
|
||||
index,
|
||||
rest_total_hits_as_int: true,
|
||||
size,
|
||||
body
|
||||
});
|
||||
return (resp.hits.total !== 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -319,7 +319,11 @@ export class DataVisualizer {
|
|||
};
|
||||
filterCriteria.push({ exists: { field } });
|
||||
|
||||
const resp = await this.callWithRequest('search', { index, size, body });
|
||||
const resp = await this.callWithRequest('search', {
|
||||
index,
|
||||
rest_total_hits_as_int: true,
|
||||
size,
|
||||
body });
|
||||
return (resp.hits.total > 0);
|
||||
}
|
||||
|
||||
|
@ -710,7 +714,12 @@ export class DataVisualizer {
|
|||
}
|
||||
};
|
||||
|
||||
const resp = await this.callWithRequest('search', { index, size, body });
|
||||
const resp = await this.callWithRequest('search', {
|
||||
index,
|
||||
rest_total_hits_as_int: true,
|
||||
size,
|
||||
body
|
||||
});
|
||||
const stats = {
|
||||
fieldName: field,
|
||||
examples: []
|
||||
|
|
|
@ -80,6 +80,7 @@ export function jobAuditMessagesProvider(callWithRequest) {
|
|||
const resp = await callWithRequest('search', {
|
||||
index: ML_NOTIFICATION_INDEX_PATTERN,
|
||||
ignore_unavailable: true,
|
||||
rest_total_hits_as_int: true,
|
||||
size: SIZE,
|
||||
body:
|
||||
{
|
||||
|
@ -107,6 +108,7 @@ export function jobAuditMessagesProvider(callWithRequest) {
|
|||
const resp = await callWithRequest('search', {
|
||||
index: ML_NOTIFICATION_INDEX_PATTERN,
|
||||
ignore_unavailable: true,
|
||||
rest_total_hits_as_int: true,
|
||||
size: 0,
|
||||
body: {
|
||||
query: {
|
||||
|
|
|
@ -120,6 +120,7 @@ export function resultsServiceProvider(callWithRequest) {
|
|||
|
||||
const resp = await callWithRequest('search', {
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
rest_total_hits_as_int: true,
|
||||
size: maxRecords,
|
||||
body: {
|
||||
query: {
|
||||
|
@ -201,6 +202,7 @@ export function resultsServiceProvider(callWithRequest) {
|
|||
async function getCategoryExamples(jobId, categoryIds, maxExamples) {
|
||||
const resp = await callWithRequest('search', {
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
rest_total_hits_as_int: true,
|
||||
size: DEFAULT_QUERY_SIZE, // Matches size of records in anomaly summary table.
|
||||
body: {
|
||||
query: {
|
||||
|
@ -235,6 +237,7 @@ export function resultsServiceProvider(callWithRequest) {
|
|||
async function getCategoryDefinition(jobId, categoryId) {
|
||||
const resp = await callWithRequest('search', {
|
||||
index: ML_RESULTS_INDEX_PATTERN,
|
||||
rest_total_hits_as_int: true,
|
||||
size: 1,
|
||||
body: {
|
||||
query: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue