Can I use Elasticsearch on Azure? Yes, indeed!
Posted: (EET/GMT+2)
Today's post is about Elasticsearch and its support for Azure cloud. Can you run Elasticsearch on Azure? Yes, you can! There are two main approaches:
- Managed offering: Elasticsearch (Elastic Cloud) is available through the Azure Marketplace.
- Self-managed: your own Elasticsearch cluster can run on Azure virtual machines.
The managed option is easiest to get started with: Elastic handles cluster setup, scaling, and upgrades, and you connect to it with the usual Elasticsearch client libraries from .NET.
For self-managed clusters, more work is needed. The typical steps would include:
- Create a the VMs (for example, Linux VMs) to run Elasticsearch.
- Install Elasticsearch and configure node roles (master, data, or ingest).
- Use Azure Load Balancer or Application Gateway in front of the cluster.
- Store data on managed disks for durability.
From .NET/C# code, you can use the official NEST client to talk to Elasticsearch. As a quick example, it would look something like this:
var settings = new ConnectionSettings(new Uri("https://my-es.example.com"))
.DefaultIndex("logs");
var client = new ElasticClient(settings);
var response = client.Search<LogEntry>(s => s
.Query(q => q.MatchAll())
);
So if you like Elasticsearch's querying and indexing model, Azure is a good place to run it.