# Why ElasticSearch was written in Java?

**URL:** https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035
**Category:** Elasticsearch
**Created:** [May 21, 2019, 2:56pm UTC](https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035 "2019-05-21T14:56:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![chughpiyush](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@chughpiyush](https://discuss.elastic.co/u/chughpiyush)
#### Post date: [May 21, 2019, 2:56pm UTC](https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035/1 "2019-05-21T14:56:18Z")

</div>

I am exploring other languages than Java. What I have learnt till date is that there is no silver bullet to solve each kind of use case and one needs to choose a language on the basis of what problem they are trying to solve .

What triggered this question were these two blog posts:

- [Why Docker was written in Go?](https://www.slideshare.net/jpetazzo/docker-and-go-why-did-we-decide-to-write-docker-in-go)
- [Why Kubernates was written in Go?](https://blog.gopheracademy.com/birthday-bash-2014/kubernetes-go-crazy-delicious/)

The first version of Elasticsearch was released in 2010, and there has to be a reason why Java was chosen for it.

> **Follow up question:** What other language would be better performing for Elasticsearch if it was to be rewritten today? Would GoLang be a better choice than Java?

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [May 21, 2019, 3:04pm UTC](https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035/2 "2019-05-21T15:04:34Z")

</div>

Hi Piyush,  
Putting aside the pros and cons of Java as a language, a simplistic answer would be "because the core library on which elasticsearch depends (Lucene) is written in Java"

---

<div class="post-metadata">

### Author: ![chughpiyush](https://avatars.discourse-cdn.com/v4/letter/c/7ea924/32.png) [@chughpiyush](https://discuss.elastic.co/u/chughpiyush)
#### Post date: [May 21, 2019, 3:40pm UTC](https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035/3 "2019-05-21T15:40:53Z")

</div>

Thanks for your reply Mark. One additional question, though I am not sure you will have an answer for me but I'll ask anyway, why the core library (Lucene) was written in Java? Wasn't C or C++ a better choice for such a core piece of software as C/C++ are closer to machine language as compared to Java?

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [May 21, 2019, 4:00pm UTC](https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035/4 "2019-05-21T16:00:47Z")

</div>

Doug Cutting was the original creator of Lucene (and later, Hadoop).  
He [said this](https://www.zipcodewilmington.com/blog/3-modern-apps-and-companies-that-use-java) of the decision to use Java for Hadoop:

> "Java offers a good compromise between developer productivity and runtime performance. Developers benefit from a simple, powerful, type-safe language with a wide range of high quality libraries. Performance is generally good enough"

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 18, 2019, 4:01pm UTC](https://discuss.elastic.co/t/why-elasticsearch-was-written-in-java/182035/5 "2019-06-18T16:01:04Z")

</div>

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