mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
parent
b02581aa15
commit
3d72127138
9 changed files with 13 additions and 1 deletions
|
@ -52,6 +52,7 @@ export default async (req, panel) => {
|
|||
if (!bodies.length) return { responses: [] };
|
||||
try {
|
||||
const resp = await callWithRequest(req, 'msearch', {
|
||||
rest_total_hits_as_int: true,
|
||||
body: bodies.reduce((acc, item) => acc.concat(item), [])
|
||||
});
|
||||
const results = {};
|
||||
|
|
|
@ -25,6 +25,7 @@ export function getSeriesData(req, panel) {
|
|||
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('data');
|
||||
const bodies = panel.series.map(series => getRequestParams(req, panel, series));
|
||||
const params = {
|
||||
rest_total_hits_as_int: true,
|
||||
body: bodies.reduce((acc, items) => acc.concat(items), [])
|
||||
};
|
||||
return callWithRequest(req, 'msearch', params)
|
||||
|
|
|
@ -32,6 +32,7 @@ export function getColumnData(req, panel, entities, client) {
|
|||
}
|
||||
}
|
||||
const params = {
|
||||
rest_total_hits_as_int: true,
|
||||
body: getRequestParams(req, panel, entities)
|
||||
};
|
||||
return client('msearch', params)
|
||||
|
|
|
@ -69,6 +69,7 @@ export const defaultSearchStrategy = {
|
|||
} = await serializeAllFetchParams(allFetchParams, searchRequests, serializeFetchParams);
|
||||
|
||||
const msearchParams = {
|
||||
rest_total_hits_as_int: true,
|
||||
body: serializedFetchParams,
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,11 @@ describe('defaultSearchStrategy', function () {
|
|||
expect(searchArgs.es.msearch.mock.calls[0][0].max_concurrent_shard_requests).toBe(42);
|
||||
});
|
||||
|
||||
test('should set rest_total_hits_as_int to true on a request', async () => {
|
||||
await search(searchArgs);
|
||||
expect(searchArgs.es.msearch.mock.calls[0][0]).toHaveProperty('rest_total_hits_as_int', true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ module.exports = (function () {
|
|||
const dataForServer = JSON.stringify(request);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'http://localhost:9200/' + indexName + '/_search',
|
||||
url: 'http://localhost:9200/' + indexName + '/_search?rest_total_hits_as_int=true',
|
||||
dataType: 'json',
|
||||
contentType: 'application/json;charset=utf-8', //Not sure why this was necessary - worked without elsewhere
|
||||
async: true,
|
||||
|
|
|
@ -11,6 +11,7 @@ export async function callEsSearchApi({ callCluster, index, body }) {
|
|||
return {
|
||||
ok: true,
|
||||
resp: await callCluster('search', {
|
||||
rest_total_hits_as_int: true,
|
||||
index,
|
||||
body
|
||||
})
|
||||
|
|
|
@ -87,6 +87,7 @@ export function getReportCountsByParameter(callCluster, config, fields, withinDa
|
|||
}
|
||||
|
||||
const params = {
|
||||
rest_total_hits_as_int: true,
|
||||
index: `${reportingIndex}-*`,
|
||||
filterPath: ['hits.total'],
|
||||
body: {
|
||||
|
|
|
@ -26,6 +26,7 @@ export function registerSearchRoute(server) {
|
|||
const requests = request.payload.map(({ index, query }) => (
|
||||
callWithRequest('rollup.search', {
|
||||
index,
|
||||
rest_total_hits_as_int: true,
|
||||
body: query,
|
||||
})
|
||||
));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue