Skip to content

Commit

Permalink
[ML] Adds a check if query is a match_all query.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Apr 1, 2020
1 parent 05b60ae commit 3664138
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/transform/public/app/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function getPreviewRequestBody(
},
};

if (!isDefaultQuery(query)) {
if (!isDefaultQuery(query) && !isMatchAllQuery(query)) {
request.source.query = query;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
EuiText,
} from '@elastic/eui';

import { getPivotQuery, isDefaultQuery } from '../../../../common';
import { getPivotQuery, isDefaultQuery, isMatchAllQuery } from '../../../../common';
import { PivotPreview } from '../../../../components/pivot_preview';
import { SearchItems } from '../../../../hooks/use_search_items';

Expand Down Expand Up @@ -60,24 +60,29 @@ export const StepDefineSummary: FC<Props> = ({
<span>{searchString}</span>
</EuiFormRow>
)}
{typeof searchString === 'undefined' && !isDefaultQuery(pivotQuery) && (
<EuiFormRow
label={i18n.translate('xpack.transform.stepDefineSummary.queryCodeBlockLabel', {
defaultMessage: 'Query',
})}
>
<EuiCodeBlock
language="js"
fontSize="s"
paddingSize="s"
color="light"
overflowHeight={300}
isCopyable
{typeof searchString === 'undefined' &&
!isDefaultQuery(pivotQuery) &&
!isMatchAllQuery(pivotQuery) && (
<EuiFormRow
label={i18n.translate(
'xpack.transform.stepDefineSummary.queryCodeBlockLabel',
{
defaultMessage: 'Query',
}
)}
>
{JSON.stringify(pivotQuery, null, 2)}
</EuiCodeBlock>
</EuiFormRow>
)}
<EuiCodeBlock
language="js"
fontSize="s"
paddingSize="s"
color="light"
overflowHeight={300}
isCopyable
>
{JSON.stringify(pivotQuery, null, 2)}
</EuiCodeBlock>
</EuiFormRow>
)}
</Fragment>
)}

Expand Down

0 comments on commit 3664138

Please sign in to comment.