Skip to content

Commit

Permalink
Fix type error in phrase_filter.ts (#50713)
Browse files Browse the repository at this point in the history
The PhraseFilter type definition incorrectly put the script property under meta when in fact the constructor has always put it at the top level.
  • Loading branch information
Bargs authored Nov 19, 2019
1 parent b354e7d commit dfcf29a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/plugins/data/common/es_query/filters/phrase_filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ export type PhraseFilterMeta = FilterMeta & {
params?: {
query: string; // The unformatted value
};
field?: any;
index?: any;
};

export type PhraseFilter = Filter & {
meta: PhraseFilterMeta;
script?: {
script: {
source?: any;
lang?: string;
params: any;
};
};
field?: any;
index?: any;
};

export type PhraseFilter = Filter & {
meta: PhraseFilterMeta;
};

type PhraseFilterValue = string | number | boolean;
Expand Down Expand Up @@ -79,7 +79,7 @@ export const buildPhraseFilter = (
return {
meta: { index: indexPattern.id, field: field.name } as PhraseFilterMeta,
script: getPhraseScript(field, value),
} as PhraseFilter;
};
} else {
return {
meta: { index: indexPattern.id },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getExistingFilter(
}

if (esFilters.isScriptedPhraseFilter(filter)) {
return filter.meta.field === fieldName && filter.meta.script!.script.params.value === value;
return filter.meta.field === fieldName && filter.script!.script.params.value === value;
}
});
}
Expand Down

0 comments on commit dfcf29a

Please sign in to comment.