# Adding image to record

**URL:** https://discuss.elastic.co/t/adding-image-to-record/98241
**Category:** Elasticsearch
**Created:** [August 24, 2017, 1:17pm UTC](https://discuss.elastic.co/t/adding-image-to-record/98241 "2017-08-24T13:17:24Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vineets928](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineets928/32/94852_2.png) [@vineets928](https://discuss.elastic.co/u/vineets928)
#### Post date: [August 24, 2017, 1:17pm UTC](https://discuss.elastic.co/t/adding-image-to-record/98241/1 "2017-08-24T13:17:24Z")

</div>

Hi,  
We migrated MySql employee table to elasticsearch and it is working good. Now, we want to add .jpg image to every employee record which is in folder on the same node. I don't have any clue how to do this.  
Can anyone please help me so we can add image to each record.

---

<div class="post-metadata">

### Author: ![geekpete](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/geekpete/32/20409_2.png) [@geekpete](https://discuss.elastic.co/u/geekpete)
#### Post date: [September 1, 2017, 6:09am UTC](https://discuss.elastic.co/t/adding-image-to-record/98241/2 "2017-09-01T06:09:37Z")

</div>

Depending on how you'll be wanting to use/display the images, you can probably do it a couple of ways.

One way is only to store a reference to some external location of the image per document.  
For example if you had every user's image stored on a remote http server, you could store the url per user in their doc and then use that url to retrieve/display the image depending on what you were using to display the image.

Kibana could even display the images with a field formatter if you wanted, see this (slightly older) blog post that demonstrates this technique:

> **[Field Formatters in Kibana 4.1
	  	 | Elastic](https://www.elastic.co/blog/kibana-4-1-field-formatters)**
>
> One of the new features in Kibana 4.1 that we are really excited about is field formatters. Field formatters allow you to display your data in Kibana the way you prefer to see it, regardless...

You can also store the raw image data inside the document as base64 encoded data in a field using the binary data type:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/binary.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/binary.html)

---

<div class="post-metadata">

### Author: ![vineets928](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineets928/32/94852_2.png) [@vineets928](https://discuss.elastic.co/u/vineets928)
#### Post date: [September 4, 2017, 2:06pm UTC](https://discuss.elastic.co/t/adding-image-to-record/98241/3 "2017-09-04T14:06:41Z")

</div>

@geekpete thanks for the detailed info. Now I have some query

1. How to store url in the doc?
2. I have to enter url of each user manually?

---

<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: [October 2, 2017, 2:07pm UTC](https://discuss.elastic.co/t/adding-image-to-record/98241/4 "2017-10-02T14:07:35Z")

</div>

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