Skip to content

Instantly share code, notes, and snippets.

@davidyell
Last active November 9, 2015 10:40
Show Gist options
  • Save davidyell/66293f7d50f52abc9d85 to your computer and use it in GitHub Desktop.
Save davidyell/66293f7d50f52abc9d85 to your computer and use it in GitHub Desktop.
A series of questions about Elasticsearch

#Preface These are a number of questions I've distilled over my first week of using Elasticsearch.

Should an application use a single index?

When ingesting data into Elasticsearch should you be using a single index for each application and then use types within that index to break up the data?

My current setup is like this, with a project index, users and leagues types within that index.

How to deal with document overlaps?

If you are storing documents in two different types how do you deal with documents in different types which contain the same data? For example, a User document which contains a League and then a League document which contains the User.

Are larger documents better?

Is it more beneficial to store a large document, or a greater amount of smaller documents? If I need to analyse Users in Leagues it makes sense to include all the leagues which the user is in. The opposite method raises the further question of how to relate documents inside Elasticsearch if they are normalised.

How to accurately sync data between an RDBMS and Elasticsearch

My main use-case is a web application, and as such I need to sync my data from MySQL into Elasticsearch on a regular basis so that any data I pull from Elasticsearch is consistant with MySQL data the admin team are seeing in the CMS.

My current setup is that I have a bulk import command line task to import documents from MySQL into Elasticsearch, and then I have a listener which listens for afterSave and afterDelete events which then update the matching Elasticsearch document.

What's the best way to build mappings using PHP?

As my documents share certain parts of each others documents, how can I build my mappings in a way that allows the documents to share their mapping in my code to prevent my mappings being repeated.

@davidyell
Copy link
Author

Should an application use a single index?
http://stackoverflow.com/a/14554767/234451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment