Behzad Hassani
Behzad Hassani

Reputation: 2139

load data to elastic search from sql server

I'm new to elastic search and I have a basic question. I want to load data from database and search them by using elastic search in MVC.NET project, but cause of data I have in my database's table I cant't convert all of them to the json and search in thme by using elastic search. How should I fill data of the elastic search from the database in an mvc.net project. I don't want the whole solution because it is impossible just a general and brief explanation. thank you very much.

Upvotes: 2

Views: 980

Answers (1)

user3775217
user3775217

Reputation: 4803

First of all you should be able to model your data from SQL to ElasticSearch. As ElasticSearch is a NoSQL and document oriented database/search engine. You need an indexer to index SQL data to ElasticSearch. Get all the columns associated with one record that you want to search in ElasticSearch from your SQL database (use joins if data is in multiple tables). Use a dedicated Stored Procedure to get only needed data and construct a document class, serialize to JSON and index in your ElasticSearch cluster.

Use ElasticSearch.net client as they very neatly expose bulk index APIs.

Hope this will get you started. Have fun

Upvotes: 1

Related Questions