# How can I import an timelion graph?

**URL:** <https://discuss.elastic.co/t/how-can-i-import-an-timelion-graph/92201>\
**Category:** Elasticsearch\
**Created:** [July 7, 2017, 5:10am UTC](https://discuss.elastic.co/t/how-can-i-import-an-timelion-graph/92201 "2017-07-07T05:10:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mathias/32/23176_2.png) [@mathias](https://discuss.elastic.co/u/mathias)\
**Post date:** [July 7, 2017, 5:10am UTC](https://discuss.elastic.co/t/how-can-i-import-an-timelion-graph/92201/1 "2017-07-07T05:10:51Z")

</div>

Hi,

I have created a graph using a formula.  
A timelion script was used and the graph is successfully plotted.  
The script looks like:

> .es(index='events-\*',q='type:counter AND name:n\_received\_bytes AND tags.path\_identifier:1',metric='sum:value').scale\_interval(1s).multiply(8).divide(1000)

I save this visualization and export it.  
Next step is to import it after a clean installation.  
I load the script:

> curl -XPUT '[http://elasticsearch.service.consul:9200/.kibana/visualization/VPP\_Total\_Throughput](http://elasticsearch.service.consul:9200/.kibana/visualization/VPP_Total_Throughput)' -d'{  
> "title": "VPP\_Total\_Throughput",  
> "visState": "{"title":"VPP\_Total\_Throughput","type":"timelion","params":{"expression":".es(index='events-_',q='type:counter AND name:n\_received\_bytes AND tags.path\_identifier:1',metric='sum:value').scale\_interval(1s).multiply(8).divide(1000)","interval":"auto"},"aggs":[],"listeners":{}}",  
> "uiStateJSON": "{}",  
> "description": "",  
> "version": 1,  
> "kibanaSavedObjectMeta": {  
> "searchSourceJSON": "{"query":{"query\_string":{"query":"_"}},"filter":}"  
> }  
> }'

but this does not work.  
I get the following error:

> {"error":{"root\_cause":[{"type":"mapper\_parsing\_exception","reason":"failed to parse [visState]"}],"type":"mapper\_parsing\_exception","reason":"failed to parse [visState]","caused\_by":{"type":"json\_e\_o\_f\_exception","reason":"Unexpected end-of-input in VALUE\_STRING\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@78bc545f; line: 3, column: 308]"}},"status":400}curl: (6) Could not resolve host: AND  
> curl: (6) Could not resolve host: name  
> curl: (6) Could not resolve host: AND  
> curl: (3) [globbing] unmatched close brace/bracket in column 109

I have validated the json-file in several online validators and the json is good.  
I have exported/imported other visualizations (not timelion) successfully.

Do you need to do any special trix with escape codes when importing timelion vizualisations?

Br Mathias

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 10, 2017, 6:46am UTC](https://discuss.elastic.co/t/how-can-i-import-an-timelion-graph/92201/2 "2017-07-10T06:46:51Z")

</div>

Looks like a quoting issue.

Can you put that into a file and try `-d @FILENAME` instead?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 7, 2017, 6:46am UTC](https://discuss.elastic.co/t/how-can-i-import-an-timelion-graph/92201/3 "2017-08-07T06:46:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
