7

I want to use on entity framework with elastic search.

I saw this article MVC APPLICATION WITH ENTITY FRAMEWORK AND ELASTICSEARCH.

But as I understood, I need 2 DB (ms sql+ elastic) and there they explain how to translate the data.

The ms sql I will save the data and I done the search on the elastic .

So all the data will be twice so it will be waste of storage...

Is there any direct way to do that?

thanks

2
  • Split your logic in two, store in your ES criterias and its respective IDs, then use those IDs to retrieve from SQL db. Commented Dec 5, 2016 at 2:01
  • Im working on a custom elastic provider, you can contribute github.com/exitxhu/Exitxhu.EntityFrameworkCore.Elastic Commented Jul 16 at 21:16

2 Answers 2

6

You can use entity framework with elastic search by utilising ElasticsearchCrud api.

This article clearly explains the steps to do so.

P.S: I rather not to copy/paste the steps here as it might look redundant.

Sign up to request clarification or add additional context in comments.

Comments

3

Yes you understood right you would need to use two different sources. There is no direct way to use elasticsearch with EF, you would need to write you custom logic to fit Database and Elasticsearch together.

If you ask why? Answer is that Database and Elasticsearch are different.

First of all Elastic is document database and you should save whole object while in database you can split items to multiple tables in ES "preferable" to save as a one document (Still in ES you can use nested objects but you will not be able to join).

Secondly search queries are totally different in SQl and Elastic. So sometimes only you would decide which source should be used to search. To search Elastic you can use NEST package but you would need to learn ES queries and indexing part since depends on analysis you will have defferent results.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.