Apache Solr & Elastisearch

Jun 11 · 2 min read

Both Apache Solr & Elastic Search are enterprise search “servers” and based on opensource Search library Apache Lucene

Apache Lucene:

Quoting their official website:

Apache LuceneTM is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform.

Lucene Core provides amazing capabilities, all listed here: https://lucene.apache.org/core/#powerful-accurate-and-efficient-search-algorithms

Spatial Search: Lucene supported it from 4.x using spatial4j https://lucene.apache.org/core/4_0_0/spatial/index.html

Apache Solr

Quoting their official website:

Solr is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration and more.

List of features listed here: https://lucene.apache.org/solr/features.html. Key features include Schemaless mode and geospatial search (https://lucene.apache.org/solr/guide/spatial-search.html).

Elastic Search

Quoting their official website:

Elasticsearch is an open source distributed, RESTful search and analytics engine. Elasticsearch lets you perform and combine many types of searches — structured, unstructured, geo, metric — any way you want

How Elastic Search works: https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-concepts.html — If you are new to cluster / nodes / shards / replicas etc, this is a good place to get a basic primer on those.

I prefer running the services in a docker container. Instructions here: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

Playing around search:
https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-explore-data.html has instructions to load some sample data and run some basic queries like below:

GET with request params in URL:

curl -X GET “localhost:9200/bank/_search?q=*&sort=account_number:asc&pretty

or better way to do GET — request params in the body:

curl -X GET "localhost:9200/bank/_search" -H 'Content-Type: application/json' -d'
“query”: { “match_all”: {} },
“sort”: [
{ “account_number”: “asc” }
curl -X GET “localhost:9200/bank/_search?pretty” -H ‘Content-Type: application/json’ -d’
“query”: { “match_phrase”: { “address”: “mill lane” } }


My technical posts mostly on Java backend services


Written by

Software Engineer working on Java based Micro-services deployed on AWS cloud. California, US resident currently — born and brought up in Bangalore, India.


My technical posts mostly on Java backend services

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade