This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Calculate Your Savings on Cloudways and Compare With Kinsta, WP Engine and Flywheel. Calculate Now

Elasticsearch is now available on Cloudways

Updated on February 15, 2018

3 Min Read

Cloudways recently added one of the most famous Search and Analytics engine, Elasticsearch. It’s written in Java and comes with the awesome RESTful API.


The Cloudways Platform offers 1-click installation and configuration of ElasticSearch for its Agile fans. Developers can now quickly deploy and test Elasticsearch based backends and web services, along with managing important configurations of Elasticsearch from the console (like memory allocation) at the ease of a click.

There are lots of businesses using Elasticsearch for their varying big data and search needs. Content companies, like Deezer, SoundCloud and The Guardian use Elasticsearch to make feature-rich search systems. Here you will find many interesting use cases of Elasticsearch.

In Elasticsearch, we have Cluster which may contain one or multiple Nodes. (To know more, here is a comprehensive Glossary for ElasticSearch.) The current Default configuration of Cloudways supports 1 Cluster with 1 Node.

Just like we have Databases and Tables in MySQL, we have Indexes and Types in Elasticsearch.

MySQL ⇒ Databases ⇒ Tables ⇒ Columns/Rows
Elasticsearch ⇒ Indices ⇒ Types ⇒ Documents with Properties

Data in Index is stored in the form of Primary Shards and Replica Shards. When creating an index, you define how many Primary shards this index will use. By default, they are 5. So, on the Cloudways Platform when you create an index, it will be distributed on 5 shards on the same node.

Since we are not using multiple nodes, replica shards will not be created with Cloudways.

Here is a nice walk through of PHP API for ElasticSearch. Using that you can expose a web service or API to collect data into ElasticSearch from multiple external resources. We have tested it on the Cloudways Platform and they work perfectly fine.

Let’s look at an example on how simply you can stash your data into elasticsearch, and then retrieve it. This is a little program on python which gives you a little overview, just make sure you have ElasticSearch installed and enabled on your Cloudways Platform.
First install a simple php app on your Cloudways server and use pip to meet your dependencies inside your application folder:

$pip install --target=/mnt/data/home/master/applications/<your_app_folder>/public_html elasticsearch

$pip install --target=/mnt/data/home/master/applications/<your_app_folder>/public_html PySocks

Now create a simple python application name it and let’s play with it a little bit.
from datetime import datetime

#pulling elasticsearch library
from elasticsearch import Elasticsearch
es = Elasticsearch()

#preparing the object to stash
doc = {
'author': 'J. R. R. Tolkien',
'text': 'Not all those who wander are lost',

#preparing indexes
res = es.index(index="quote-index", doc_type='tweet', id=1, body=doc)

res = es.get(index="quote-index", doc_type='tweet', id=1)


#fetching results
res ="quote-index", body={"query": {"match_all": {}}})
print("Got %d Hits:" % res['hits']['total'])
for hit in res['hits']['hits']:
print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])

There you go, a pretty outcome of your stashed results:

Share your opinion in the comment section. COMMENT NOW

Share This Article

Start Creating Web Apps on Managed Cloud Servers Now

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry.

Aaqib Gadit

Aaqib Gadit is the Co-founder and CEO of Cloudways, a multi-cloud managed application hosting platform for SMBs to save them time and money and allow them to grow their business with peace of mind and improved productivity without worrying about infra and application management hassles. He is a hands-on, execution-oriented leader and a serial entrepreneur with expertise in product, growth, tech, customer support, and customer success, particularly in the context of SaaS, Infrastructure, and Open Source where he founded multiple companies since 2008.


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Unleash The Cloud.
Not Budgets.

For 4 Months +
Up To 30 Free Migrations

Cyber Week

Time Left In Offer
  • 0


  • 0


  • 0


  • 0


40% OFF

On All Plans