jbdeguzman jbdeguzman - 1 month ago 9
C# Question

Implementing ElasticSearch in C# with a mySQL DB

We're getting a lot of errors in some of our search pages that were probably caused by having too many records in our mySQL DB. We're thinking of ways on how to resolve it. One of which is trying out ElasticSearch. We will still store all the data in our mySQL DB but use the power of ElasticSearch for some querying purposes.

So, how can we implement ElasticSearch with our website built using C# that currently has a mySQL DB for data storage?

Note: For the sake of directly answering my question, just assume that there is no other way to resolve our issue on the search pages other than using ElasticSearch.

Answer Source

You need to have elasticsearch river plugin that periodically pulls data from mySQL and index it on elasticsearch. Couple of such plugins, I came across

elasticsearch-river-jdbc - https://github.com/jprante/elasticsearch-river-jdbc Elasticsearch-MySQL-River - https://github.com/mallocator/Elasticsearch-MySQL-River

Once you have your data indexed on elasticsearch, you can search them using,

  1. Elastic Search REST APIs
  2. Elastic Search .NET Client - https://github.com/elasticsearch/elasticsearch-net