Skip to content

Commit 39936a2

Browse files
committed
Add functional test for dynamic styles by date field
1 parent b7fcbe7 commit 39936a2

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

x-pack/test/functional/apps/maps/documents_source/docvalue_fields.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,15 @@ export default function ({ getPageObjects, getService }) {
4343
expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates,bytes,hour_of_day');
4444
});
4545

46+
it('should format date fields as epoch_millis when data driven styling is applied to a date field', async () => {
47+
await PageObjects.maps.loadSavedMap('document example with data driven styles on date field');
48+
const response = await getResponse();
49+
const firstHit = response.hits.hits[0];
50+
expect(Object.keys(firstHit).join(',')).to.equal('_index,_type,_id,_score,fields');
51+
expect(Object.keys(firstHit.fields).join(',')).to.equal('geo.coordinates,bytes,@timestamp');
52+
expect(firstHit.fields['@timestamp']).to.be.an('array');
53+
expect(firstHit.fields['@timestamp'][0]).to.equal('1442709321445');
54+
});
55+
4656
});
4757
}

x-pack/test/functional/es_archives/maps/kibana/data.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,62 @@
334334
}
335335
}
336336

337+
{
338+
"type": "doc",
339+
"value": {
340+
"id": "map:c9277dd0-eb8f-11e9-ae47-693d6a50fb9e",
341+
"index": ".kibana",
342+
"source": {
343+
"map": {
344+
"title" : "document example with data driven styles on date field",
345+
"description" : "",
346+
"mapStateJSON": "{\"zoom\":4.1,\"center\":{\"lon\":-100.61091,\"lat\":33.23887},\"timeFilters\":{\"from\":\"2015-09-20T00:00:00.000Z\",\"to\":\"2015-09-20T01:00:00.000Z\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":1000},\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filters\":[]}",
347+
"layerListJSON": "[{\"id\":\"0hmz5\",\"sourceDescriptor\":{\"type\":\"EMS_TMS\",\"id\":\"road_map\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"TILE\",\"properties\":{}},\"type\":\"VECTOR_TILE\",\"minZoom\":0,\"maxZoom\":24},{\"id\":\"z52lq\",\"label\":\"logstash\",\"minZoom\":0,\"maxZoom\":24,\"sourceDescriptor\":{\"id\":\"e1a5e1a6-676c-4a89-8ea9-0d91d64b73c6\",\"type\":\"ES_SEARCH\",\"geoField\":\"geo.coordinates\",\"limit\":2048,\"filterByMapBounds\":true,\"showTooltip\":true,\"tooltipProperties\":[],\"indexPatternRefName\":\"layer_1_source_index_pattern\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"color\":\"Blues\",\"field\":{\"label\":\"@timestamp\",\"name\":\"@timestamp\",\"origin\":\"source\"}}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":1}},\"iconSize\":{\"type\":\"DYNAMIC\",\"options\":{\"minSize\":4,\"maxSize\":24,\"field\":{\"label\":\"bytes\",\"name\":\"bytes\",\"origin\":\"source\"}}},\"iconOrientation\":{\"type\":\"STATIC\",\"options\":{\"orientation\":0}},\"symbol\":{\"options\":{\"symbolizeAs\":\"circle\",\"symbolId\":\"airfield\"}}}},\"type\":\"VECTOR\"}]",
348+
"uiStateJSON": "{\"isLayerTOCOpen\":true,\"openTOCDetails\":[]}",
349+
"bounds" : {
350+
"type" : "Polygon",
351+
"coordinates" : [
352+
[
353+
[
354+
-132.42879,
355+
44.5711
356+
],
357+
[
358+
-132.42879,
359+
20.22627
360+
],
361+
[
362+
-68.79303,
363+
20.22627
364+
],
365+
[
366+
-68.79303,
367+
44.5711
368+
],
369+
[
370+
-132.42879,
371+
44.5711
372+
]
373+
]
374+
]
375+
}
376+
},
377+
"type" : "map",
378+
"references" : [
379+
{
380+
"name" : "layer_1_source_index_pattern",
381+
"type" : "index-pattern",
382+
"id" : "c698b940-e149-11e8-a35a-370a8516603a"
383+
}
384+
],
385+
"migrationVersion" : {
386+
"map" : "7.5.0"
387+
},
388+
"updated_at" : "2019-10-10T18:57:19.916Z"
389+
}
390+
}
391+
}
392+
337393
{
338394
"type": "doc",
339395
"value": {

0 commit comments

Comments
 (0)