Java API


(samCougars) #1

I'm using JAVA api for ES. I am creating index with this command:
client.prepareIndex("myEventSpecific", "myObject", "myID").setSource("myJsonText").execute().actionGet();

On my home directory, I see "searchdata" folder even I have specified to use "myEventSpecific". So I see both "myEventSpecific" and "searchdata" folders inside my indices folder. Do you know why it creates "searchdata" folder?
This is how my folder structure is:
1.myhomeDirectory/data/myEventSpecific/nodes/0/indices/myEventSpecific
2.myhomeDirectory/data/myEventSpecific/nodes/0/indices/searchdata


(Eric Jain) #2

On May 9, 9:44 am, samCougars sban...@gmail.com wrote:

This is how my folder structure is:
1.myhomeDirectory/data/myEventSpecific/nodes/0/indices/myEventSpecific
2.myhomeDirectory/data/myEventSpecific/nodes/0/indices/searchdata

I've never seen a "searchdata" folder. If you delete it, is it
recreated?


(Ivan Brusic) #3

I suspect it is not the code you pasted, but your client.

Which client are you creating: a NodeClient or TransportClient? How
are you creating the client? Are you setting node.client = true?

--
Ivan

On Wed, May 9, 2012 at 9:44 AM, samCougars sbaniya@gmail.com wrote:

I'm using JAVA api for ES. I am creating index with this command:
client.prepareIndex("myEventSpecific", "myObject",
"myID").setSource("myJsonText").execute().actionGet();

On my home directory, I see "searchdata" folder even I have specified to use
"myEventSpecific". So I see both "myEventSpecific" and "searchdata" folders
inside my indices folder. Do you know why it creates "searchdata" folder?
This is how my folder structure is:
1.myhomeDirectory/data/myEventSpecific/nodes/0/indices/myEventSpecific
2.myhomeDirectory/data/myEventSpecific/nodes/0/indices/searchdata

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


(samCougars) #4

yes, once I delete the folder it still creates searchData folder...


(samCougars) #5

I'm creating a Node Client. First I create a node then get the client from node as follows:
Client client = null;
try{
ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
String eventSpecific = "myEventSpecific";
settings.put("path.home",System.getProperty("user.home")+"/elasticSearch"+eventSpecific);
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
indexCreatingNode = NodeBuilder.nodeBuilder().settings(settings).clusterName(eventSpecific).node();

 // start a node
 indexCreatingNode.start();
 // INDEX my required fields
 
 // once all my fields are indexed then 
  client = indexCreatingNode.client();
  client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();

}
catch (Exception ex)
{
log.error(ex);
}
finally
{
if (client != null)
client.close();
if (indexCreatingNode != null)
{
indexCreatingNode.stop();
indexCreatingNode.close();
}
}


(Eric Jain) #6

I just ran this code, and all I get is an empty dir:
$HOME/elasticSearchmyEventSpecific/data/myEventSpecific/nodes/0.

On Wed, May 9, 2012 at 1:55 PM, samCougars sbaniya@gmail.com wrote:

I'm creating a Node Client. First I create a node then get the client from
node as follows:
Client client = null;
try{
ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder();
String eventSpecific = "myEventSpecific";

settings.put("path.home",System.getProperty("user.home")+"/elasticSearch"+eventSpecific);
settings.put("number_of_shards",1);
settings.put("number_of_replicas",0);
indexCreatingNode =
NodeBuilder.nodeBuilder().settings(settings).clusterName(eventSpecific).node();

// start a node
indexCreatingNode.start();
// INDEX my required fields

// once all my fields are indexed then
 client = indexCreatingNode.client();

client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
}
catch (Exception ex)
{
log.error(ex);
}
finally
{
if (client != null)
client.close();
if (indexCreatingNode != null)
{
indexCreatingNode.stop();
indexCreatingNode.close();
}
}

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


(system) #7