3
votes

I am seriously considering using elastic search as my primary database. The only thing holding me back is understanding whether or not json document size slows down elastic search. For example, if I index json documents with 100 fields rather than the 3 fields I need to search (and then querying my sql db for the other data), would elastic search be any slower?

Is this concern any reason not to use elastic search as my primary data storage? I will keep a backup in a traditional database so I can rebuild the index but my plan is to primarily query elastic search. Does this sound like a good idea?

1

1 Answers

3
votes

Indexing all the fields in your JSON doc won't slow down Elasticsearch, but it will make your indexes bigger. So if disk space or RAM are limited, then perhaps you do only want to index the 3 relevant fields.

You can still store the whole doc in Elasticsearch (and set the _source field to be compressed) but disable the indexing of the irrelevant fields by setting them to "index": "no".

However if capacity isn't a problem, then why not let Elasticsearch just do its thing? You'll probably find that there are other relevant fields that you hadn't considered, and quite often you'll end up using ES to do queries that your DB would normally handle because (a) it's so damn fast and (b) it comes with easy scaling built in.