mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] Removes use of types from ES index and search calls (#28987)
This commit is contained in:
parent
082e9bc6e1
commit
ed9a599b0d
8 changed files with 5 additions and 24 deletions
|
@ -9,5 +9,4 @@ export enum ANNOTATION_TYPE {
|
|||
COMMENT = 'comment',
|
||||
}
|
||||
|
||||
export const ANNOTATION_DOC_TYPE = 'doc';
|
||||
export const ANNOTATION_USER_UNKNOWN = '<user unknown>';
|
||||
|
|
|
@ -72,7 +72,6 @@
|
|||
"indices": [
|
||||
"farequote"
|
||||
],
|
||||
"types": [],
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
|
|
|
@ -375,7 +375,6 @@ export const ml = {
|
|||
getCardinalityOfFields(obj) {
|
||||
const data = pick(obj, [
|
||||
'index',
|
||||
'types',
|
||||
'fieldNames',
|
||||
'query',
|
||||
'timeFieldName',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import Boom from 'boom';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { ANNOTATION_DOC_TYPE, ANNOTATION_TYPE } from '../../../common/constants/annotations';
|
||||
import { ANNOTATION_TYPE } from '../../../common/constants/annotations';
|
||||
import {
|
||||
ML_ANNOTATIONS_INDEX_ALIAS_READ,
|
||||
ML_ANNOTATIONS_INDEX_ALIAS_WRITE,
|
||||
|
@ -47,7 +47,6 @@ interface GetResponse {
|
|||
|
||||
interface IndexParams {
|
||||
index: string;
|
||||
type: string;
|
||||
body: Annotation;
|
||||
refresh?: string;
|
||||
id?: string;
|
||||
|
@ -55,7 +54,6 @@ interface IndexParams {
|
|||
|
||||
interface DeleteParams {
|
||||
index: string;
|
||||
type: string;
|
||||
refresh?: string;
|
||||
id: string;
|
||||
}
|
||||
|
@ -78,7 +76,6 @@ export function annotationProvider(
|
|||
|
||||
const params: IndexParams = {
|
||||
index: ML_ANNOTATIONS_INDEX_ALIAS_WRITE,
|
||||
type: ANNOTATION_DOC_TYPE,
|
||||
body: annotation,
|
||||
refresh: 'wait_for',
|
||||
};
|
||||
|
@ -232,7 +229,6 @@ export function annotationProvider(
|
|||
async function deleteAnnotation(id: string) {
|
||||
const param: DeleteParams = {
|
||||
index: ML_ANNOTATIONS_INDEX_ALIAS_WRITE,
|
||||
type: ANNOTATION_DOC_TYPE,
|
||||
id,
|
||||
refresh: 'wait_for',
|
||||
};
|
||||
|
|
|
@ -41,7 +41,6 @@ export function calculateModelMemoryLimitProvider(callWithRequest) {
|
|||
function splitFieldCardinality() {
|
||||
return fieldsService.getCardinalityOfFields(
|
||||
indexPattern,
|
||||
[],
|
||||
[splitFieldName],
|
||||
query,
|
||||
timeFieldName,
|
||||
|
@ -54,7 +53,6 @@ export function calculateModelMemoryLimitProvider(callWithRequest) {
|
|||
function influencerCardinality(influencerName) {
|
||||
return fieldsService.getCardinalityOfFields(
|
||||
indexPattern,
|
||||
[],
|
||||
[influencerName],
|
||||
query,
|
||||
timeFieldName,
|
||||
|
|
|
@ -15,7 +15,6 @@ export function fieldsServiceProvider(callWithRequest) {
|
|||
// with values equal to the cardinality of the field.
|
||||
function getCardinalityOfFields(
|
||||
index,
|
||||
types,
|
||||
fieldNames,
|
||||
query,
|
||||
timeFieldName,
|
||||
|
@ -36,10 +35,6 @@ export function fieldsServiceProvider(callWithRequest) {
|
|||
}
|
||||
];
|
||||
|
||||
if (types && types.length) {
|
||||
mustCriteria.push({ terms: { _type: types } });
|
||||
}
|
||||
|
||||
if (query) {
|
||||
mustCriteria.push(query);
|
||||
}
|
||||
|
|
|
@ -81,12 +81,10 @@ export function importDataProvider(callWithRequest) {
|
|||
if (await indexExits(index) === false) {
|
||||
const body = {
|
||||
mappings: {
|
||||
_doc: {
|
||||
_meta: {
|
||||
created_by: INDEX_META_DATA_CREATED_BY
|
||||
},
|
||||
properties: mappings
|
||||
_meta: {
|
||||
created_by: INDEX_META_DATA_CREATED_BY
|
||||
},
|
||||
properties: mappings
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -102,14 +100,13 @@ export function importDataProvider(callWithRequest) {
|
|||
|
||||
async function indexData(index, pipelineId, data) {
|
||||
try {
|
||||
const type = '_doc';
|
||||
const body = [];
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
body.push({ index: {} });
|
||||
body.push(data[i]);
|
||||
}
|
||||
|
||||
const settings = { index, type, body };
|
||||
const settings = { index, body };
|
||||
if (pipelineId !== undefined) {
|
||||
settings.pipeline = pipelineId;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ function getCardinalityOfFields(callWithRequest, payload) {
|
|||
const fs = fieldsServiceProvider(callWithRequest);
|
||||
const {
|
||||
index,
|
||||
types,
|
||||
fieldNames,
|
||||
query,
|
||||
timeFieldName,
|
||||
|
@ -23,7 +22,6 @@ function getCardinalityOfFields(callWithRequest, payload) {
|
|||
latestMs } = payload;
|
||||
return fs.getCardinalityOfFields(
|
||||
index,
|
||||
types,
|
||||
fieldNames,
|
||||
query,
|
||||
timeFieldName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue