Adding image to record


(Groot) #1

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.


(Peter Dyson) #2

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:

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


(Groot) #3

@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?

(system) #4

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