Rasmi
Rasmi

Reputation: 1

In ElasticSearch i have to create single index and multiple types or multiple index with single types?

I am new in elastic search.I am using elastic search for big data.

There is not join query in my application then which structure is best for my application?

Upvotes: 0

Views: 181

Answers (1)

Ashish Tiwari
Ashish Tiwari

Reputation: 2277

I am working on elasticserach from past few days. I would like to share my experience/learnings.

1) If we moving from relational DB like MYSQL, SQL to ES, We need to maintain all relation among all data. Declare the primary key in different types or indexes, On basis of which you can perform Query DSL.

2) In case of if you dealing with millions data everyday, You need to design accordingly. Some people prefer duration based structure like Day, Week, Month wise. Its totally depend on your use case. For large data set (~ 1TB) you need to distribute your data in various of indexes and shards .

3) If you have small data set the it will be work in default settings too (5 shrads 1 replica). It will give you better If data set is small in your shards.

4) The JOIN query can be expensive in elasticsearch. And if you frequently performing it can be impact to your HEAP. So I would suggest prepare your data set with pre-cooked data (The result data which you getting when you perform join query in Relational DBs.) & document with unique ID. You can refer this. Check here to look, How we can perform JOIN

5) There might be some points which you need to take care while designing your index:

  1. Don't treat Elasticsearch like a database
  2. Know your use case BEFORE you jump in
  3. Organize your data wisely
  4. Make smart use of replicas
  5. Base your capacity plans on experiment

6) Your wrong architecture can cause reindex which will be heavy cost with downtime. Checkout this article to know about index designing and best practices.

Upvotes: 1

Related Questions