diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.ts b/public/app/plugins/datasource/elasticsearch/elastic_response.ts index 7b10665d271..505c0b3cbc8 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.ts +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.ts @@ -580,6 +580,9 @@ const createEmptyDataFrame = ( const series = new MutableDataFrame({ fields: [] }); series.addField({ + config: { + filterable: true, + }, name: timeField, type: FieldType.time, }); @@ -615,6 +618,9 @@ const createEmptyDataFrame = ( } series.addField({ + config: { + filterable: true, + }, name: propName, type: FieldType.string, }).parse = (v: any) => { diff --git a/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts b/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts index 5d14b69445c..d158cab12f1 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/elastic_response.test.ts @@ -1152,6 +1152,47 @@ describe('ElasticResponse', () => { }); }); + describe('Raw Data Query', () => { + beforeEach(() => { + targets = [ + { + refId: 'A', + metrics: [{ type: 'raw_data', id: '1' }], + bucketAggs: [], + }, + ]; + + response = { + responses: [ + { + hits: { + total: { + relation: 'eq', + value: 1, + }, + hits: [ + { + _id: '1', + _type: '_doc', + _index: 'index', + _source: { sourceProp: 'asd' }, + }, + ], + }, + }, + ], + }; + + result = new ElasticResponse(targets, response).getTimeSeries(); + }); + + it('should create dataframes with filterable fields', () => { + for (const field of result.data[0].fields) { + expect(field.config.filterable).toBe(true); + } + }); + }); + describe('simple logs query and count', () => { const targets: any = [ {