Can Elasticsearch Store Data?

Spoiler alert: you can, and I’ll show you how. But it’s not always advisable.

Image for post
Image for post
Image by Tumisu from Pixabay

Storing JSON data in Elasticsearch

{
"_index" : "twitter",
"_type" : "_doc",
"_id" : "3Vko724Bb6gkOIFPeQcs",
"_source" : {
"username" : "eriky",
"post_date" : "2019-12-08T14:10:12",
"message" : "I wrote an article on Elasticsearch"
}
}

Storing binary data in Elasticsearch

{
"mappings": {
"properties": {
"username": {
"type": "text"
},
"message": {
"type": "text"
},
"profile_image": {
"type": "binary"
}

}
}
}
{
"username" : "eriky",
"message" : "I wrote an article on Elasticsearch",
"profile_image": "U29tZSBiaW5hcnkgYmxvYg=="
}

Conclusion

Written by

Software developer by day, writer at night. Author of python3.guide, where you can start learning Python today

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store