diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/index.tsx b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/index.tsx
index ccf8357d24a..883251e803e 100644
--- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/index.tsx
+++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/FiltersSettingsEditor/index.tsx
@@ -47,12 +47,12 @@ export const FiltersSettingsEditor = ({ bucketAgg }: Props) => {
display: flex;
`}
>
-
-
+
+
{
onChange={(query) => dispatch(changeFilter({ index, filter: { ...filter, query } }))}
query={filter.query}
/>
-
-
-
+
+
+
dispatch(changeFilter({ index, filter: { ...filter, label: e.target.value } }))}
diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/index.tsx b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/index.tsx
index fcf25e8cb76..947f86cb7c3 100644
--- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/index.tsx
+++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/index.tsx
@@ -1,15 +1,16 @@
import React from 'react';
-import { getDefaultTimeRange, QueryEditorProps } from '@grafana/data';
+import { getDefaultTimeRange, GrafanaTheme2, QueryEditorProps } from '@grafana/data';
import { ElasticDatasource } from '../../datasource';
import { ElasticsearchOptions, ElasticsearchQuery } from '../../types';
import { ElasticsearchProvider } from './ElasticsearchQueryContext';
-import { InlineField, InlineFieldRow, Input, QueryField } from '@grafana/ui';
+import { InlineField, InlineLabel, Input, QueryField, useStyles2 } from '@grafana/ui';
import { changeAliasPattern, changeQuery } from './state';
import { MetricAggregationsEditor } from './MetricAggregationsEditor';
import { BucketAggregationsEditor } from './BucketAggregationsEditor';
import { useDispatch } from '../../hooks/useStatelessReducer';
import { useNextId } from '../../hooks/useNextId';
import { metricAggregationConfig } from './MetricAggregationsEditor/utils';
+import { css } from '@emotion/css';
export type ElasticQueryEditorProps = QueryEditorProps;
@@ -25,6 +26,16 @@ export const QueryEditor = ({ query, onChange, onRunQuery, datasource, range }:
);
+const getStyles = (theme: GrafanaTheme2) => ({
+ root: css`
+ display: flex;
+ `,
+ queryFieldWrapper: css`
+ flex-grow: 1;
+ margin: 0 ${theme.spacing(0.5)} ${theme.spacing(0.5)} 0;
+ `,
+});
+
interface Props {
value: ElasticsearchQuery;
}
@@ -32,6 +43,7 @@ interface Props {
const QueryEditorForm = ({ value }: Props) => {
const dispatch = useDispatch();
const nextId = useNextId();
+ const styles = useStyles2(getStyles);
// To be considered a time series query, the last bucked aggregation must be a Date Histogram
const isTimeSeriesQuery = value.bucketAggs?.slice(-1)[0]?.type === 'date_histogram';
@@ -42,8 +54,9 @@ const QueryEditorForm = ({ value }: Props) => {
return (
<>
-
-
+
+
Query
+
{
placeholder="Lucene Query"
portalOrigin="elasticsearch"
/>
-
+
{
defaultValue={value.alias}
/>
-
+
{showBucketAggregationsEditor && }