Embedded ElasticSearch On JAVA API


(samCougars) #1

All
I am using Embedded ElasticSearch On JAVA API. It is creating indexes
correctly.
Once I create the index, I see a folder "elasticSearch" under my home
directory. But even after I remove this "elasticSearch" folder from my
home directory, it still performs the searches. Is it being stored
somewhere else too? Sometime while debugging I need to get rid of the
contents of this elastic folder, and start all over again. So, is
there any other place I need to remove elasticSearch indexes on my
box?
Thanks


(Lukáš Vlček) #2

Hi,

check here
http://www.elasticsearch.org/guide/reference/setup/dir-layout.html for
folder locations used by ES and how they can be configured (some of them
support multi locations).

You need to know how these locations are configured in your case. The
chance is that you are using in-memory indices which means that Lucene
segments are not found on the disk. You can also use gateway of type none
(which again means the gateway data is not stored on the disk). This is
typically used during unit tests. You can find a lot of examples in ES unit
test code, or you can check one example that I uploaded to github some time
ago:


Check both abstract and basic test class, how the paths are configured and
how I clean up after test.

Regards,
Lukas

On Thu, Mar 15, 2012 at 9:30 PM, Sam sbaniya@gmail.com wrote:

All
I am using Embedded ElasticSearch On JAVA API. It is creating indexes
correctly.
Once I create the index, I see a folder "elasticSearch" under my home
directory. But even after I remove this "elasticSearch" folder from my
home directory, it still performs the searches. Is it being stored
somewhere else too? Sometime while debugging I need to get rid of the
contents of this elastic folder, and start all over again. So, is
there any other place I need to remove elasticSearch indexes on my
box?
Thanks


(samCougars) #3

This is how I'm doing in java api:
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node = NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").node();

Client client = node.client();
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My data information").execute().actionGet();

When I use this to create node and index, it creates the folder "elasticSearch" under my home directory. But even after I remove "elasticSearch", it still does search. So I have no clue where it is grabbing the indexed data after I have completely deleted "elasticSearch". Any suggestions?
Thanks


(Lukáš Vlček) #4

Hi,

it is hard to answer this question without complete code example but may be
the reason is that the index data are still in memory because it hasn't
been flushed yet.
See
http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html

Regards,
Lukas

On Fri, Mar 16, 2012 at 11:42 PM, samCougars sbaniya@gmail.com wrote:

This is how I'm doing in java api:
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node =

NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").node();

Client client = node.client();

client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My data
information").execute().actionGet();

When I use this to create node and index, it creates the folder
"elasticSearch" under my home directory. But even after I remove
"elasticSearch", it still does search. So I have no clue where it is
grabbing the indexed data after I have completely deleted "elasticSearch".
Any suggestions?
Thanks

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Embedded-ElasticSearch-On-JAVA-API-tp3829957p3833388.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(samCougars) #5

Once the indexes are created, I am doing
client.admin().indices().prepareRefresh().execute().actionGet();

and it does flush.
After I have deleted elasticSearch, I was still able to perform search. I have no clue where it is grabbing data for this search. I have killed my JVM too and it still does search without elasticSearch being existed anywhere. So I ended up restarting the machine. With no elasticSearch folder and restart of my machine, it did not do a search. This makes me believe that the index is also stored somewhere in the memory with my settings. Here is my settings for a reference:
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node = NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").node();

Client client = node.client();
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My data information").execute().actionGet();

How do I prevent it NOT to be stored in memory? I want indexes to be stored ONLY in my disk location that I have provided under "setttings.put("path.home", System.getProperty("user.home")+"/elasticSearch")";


(Lukáš Vlček) #6

Hi,

based on your description it should be able to situate it using curl
command. Can you prepare complete recreation script then?

Regards,
Lukas

On Wed, Mar 21, 2012 at 12:13 AM, samCougars sbaniya@gmail.com wrote:

Once the indexes are created, I am doing
client.admin().indices().prepareRefresh().execute().actionGet();

and it does flush.
After I have deleted elasticSearch, I was still able to perform search. I
have no clue where it is grabbing data for this search. I have killed my
JVM
too and it still does search without elasticSearch being existed anywhere.
So I ended up restarting the machine. With no elasticSearch folder and
restart of my machine, it did not do a search. This makes me believe that
the index is also stored somewhere in the memory with my settings. Here is
my settings for a reference:
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node =

NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").node();

Client client = node.client();

client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My data
information").execute().actionGet();

How do I prevent it NOT to be stored in memory? I want indexes to be stored
ONLY in my disk location that I have provided under
"setttings.put("path.home",
System.getProperty("user.home")+"/elasticSearch")";

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Embedded-ElasticSearch-On-JAVA-API-tp3829957p3844082.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(Satish) #7

What is a recreation script? I'm doing this as embedded project on
webapp...

On Mar 20, 11:29 pm, Lukáš Vlček lukas.vl...@gmail.com wrote:

Hi,

based on your description it should be able to situate it using curl
command. Can you prepare complete recreation script then?

Regards,
Lukas

On Wed, Mar 21, 2012 at 12:13 AM, samCougars sban...@gmail.com wrote:

Once the indexes are created, I am doing
client.admin().indices().prepareRefresh().execute().actionGet();

and it does flush.
After I have deleted elasticSearch, I was still able to perform search. I
have no clue where it is grabbing data for this search. I have killed my
JVM
too and it still does search without elasticSearch being existed anywhere.
So I ended up restarting the machine. With no elasticSearch folder and
restart of my machine, it did not do a search. This makes me believe that
the index is also stored somewhere in the memory with my settings. Here is
my settings for a reference:
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node =

NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").no de();

Client client = node.client();

client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute() .actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My data
information").execute().actionGet();

How do I prevent it NOT to be stored in memory? I want indexes to be stored
ONLY in my disk location that I have provided under
"setttings.put("path.home",
System.getProperty("user.home")+"/elasticSearch")";

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Embedded-ElasticSearc...
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(Lukáš Vlček) #8

See http://www.elasticsearch.org/help/ regarding recreation script.
In other words, put together sequence of shell commands that demonstrate
your use case and can be used by anybody to simulate/recreate the issue, it
sounds like in your case it would be mostly 'curl' and 'rm' commands.

Regards,
Lukas

On Wed, Mar 21, 2012 at 4:58 PM, Satish satish.baniya@gmail.com wrote:

What is a recreation script? I'm doing this as embedded project on
webapp...

On Mar 20, 11:29 pm, Lukáš Vlček lukas.vl...@gmail.com wrote:

Hi,

based on your description it should be able to situate it using curl
command. Can you prepare complete recreation script then?

Regards,
Lukas

On Wed, Mar 21, 2012 at 12:13 AM, samCougars sban...@gmail.com wrote:

Once the indexes are created, I am doing
client.admin().indices().prepareRefresh().execute().actionGet();

and it does flush.
After I have deleted elasticSearch, I was still able to perform
search. I

have no clue where it is grabbing data for this search. I have killed
my

JVM
too and it still does search without elasticSearch being existed
anywhere.

So I ended up restarting the machine. With no elasticSearch folder and
restart of my machine, it did not do a search. This makes me believe
that

the index is also stored somewhere in the memory with my settings.
Here is

my settings for a reference:
ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder();

settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");

settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node =

NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").no
de();

Client client = node.client();

client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute()
.actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My
data

information").execute().actionGet();

How do I prevent it NOT to be stored in memory? I want indexes to be
stored

ONLY in my disk location that I have provided under
"setttings.put("path.home",
System.getProperty("user.home")+"/elasticSearch")";

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Embedded-ElasticSearc.
..

Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(samCougars) #9

What is a recreation script?


(Satish) #10

I have upgraded to elasticSearch 0.19.1 and it seemed to fix the
problem for now. If I remove elasticSearch data folder, it does NOT do
the search anymore.
Thanks,
Satish

On Mar 21, 10:38 am, Lukáš Vlček lukas.vl...@gmail.com wrote:

Seehttp://www.elasticsearch.org/help/regarding recreation script.
In other words, put together sequence of shell commands that demonstrate
your use case and can be used by anybody to simulate/recreate the issue, it
sounds like in your case it would be mostly 'curl' and 'rm' commands.

Regards,
Lukas

On Wed, Mar 21, 2012 at 4:58 PM, Satish satish.ban...@gmail.com wrote:

What is a recreation script? I'm doing this as embedded project on
webapp...

On Mar 20, 11:29 pm, Lukáš Vlček lukas.vl...@gmail.com wrote:

Hi,

based on your description it should be able to situate it using curl
command. Can you prepare complete recreation script then?

Regards,
Lukas

On Wed, Mar 21, 2012 at 12:13 AM, samCougars sban...@gmail.com wrote:

Once the indexes are created, I am doing
client.admin().indices().prepareRefresh().execute().actionGet();

and it does flush.
After I have deleted elasticSearch, I was still able to perform
search. I

have no clue where it is grabbing data for this search. I have killed
my

JVM
too and it still does search without elasticSearch being existed
anywhere.

So I ended up restarting the machine. With no elasticSearch folder and
restart of my machine, it did not do a search. This makes me believe
that

the index is also stored somewhere in the memory with my settings.
Here is

my settings for a reference:
ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder();

settings.put("path.home",System.getProperty("user.home")+"/elasticSearch");

settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
Node node =

NodeBuilder.nodeBuilder().settings(settings).clusterName("firstCluster").no
de();

Client client = node.client();

client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute()
.actionGet();

client.prepareIndex("searchdata", "exhibitor", "9999").setSource("My
data

information").execute().actionGet();

How do I prevent it NOT to be stored in memory? I want indexes to be
stored

ONLY in my disk location that I have provided under
"setttings.put("path.home",
System.getProperty("user.home")+"/elasticSearch")";

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Embedded-ElasticSearc.
..

Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #11