How can I run Elastic Search 5.0 in embed mode?

Do I have any opportunities to embed es(Elastic Search)? In another way, run it in the same JVM. And my code call use api instead of http/socket api to access es?

This blog post contains a discussion about embedding Elasticsearch 5.0. While it may be possible, it is no longer supported.

Do you know anyone, who did this in 5.0 successfully?

What is your motivation? JUnit testing?

No just jUnit test. I have a application focus on storage on local disk, in order to find data quickly, I write byte[] into file, and save file_name, offset, length of the data into de es. Most important, the process of my app and the process of es is 1:1. So es is not in cluster mode, and no need in cluster mode.

Now I use a network api to save data, but I think this is not efficient enough. So I look the better way to do so.

Does anyone have better ideas?

If you don't want to do integration tests, you can just Mock ES, no?

If you don't want to do integration tests, you can just Mock ES, no?

You don't need to go over the network. If you want to depart from the "supported version" path, you can try something like a standalone node. I use this approach as a "mock node" for lightweight JUnit tests which run in a single JVM

https://github.com/xbib/elasticsearch-extras-client/blob/es5/src/integration-test/java/org/elasticsearch/node/MockNode.java

See also

https://github.com/xbib/elasticsearch-extras-client/blob/es5/src/integration-test/java/org/xbib/elasticsearch/NodeTestBase.java#L195-L196

I am not running in test or need mock. I want to run in product env.
No cluster mode is what I need.

@jprante

IMO if you need a 3rd party service to test your code, then it's not a unit test but an integration test, which is a different story than embedding a node.

Again, it is not test. Sorry for the mislead anyone thought, it for unit test.
It is need in running time, use embed mode to avoid network cost.
Is this clear enough?

I see. As @Christian_Dahlqvist said, it's not supported.
As @jprante wrote, you have a workaround.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.