How to search text using java elastic search

Hi All,

This is my code..
Settings settings = ImmutableSettings.settingsBuilder()
.put("http.enabled", "false")
.put("transport.tcp.port", "9300-9400")
.put("discovery.zen.ping.multicast.enabled", "false")
.put("discovery.zen.ping.unicast.hosts", "localhost").build();

Node node =
NodeBuilder.nodeBuilder().client(true).settings(settings).clusterName("elasticsearch").node();
client = node.client();

    QueryBuilder queryBuilder = QueryBuilders.termQuery("userName", 

"SampleUser");
SearchRequestBuilder searchRequestBuilder =
client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_AND_FETCH);
searchRequestBuilder.setQuery(queryBuilder);
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp = searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output :
{
"took" : 32,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am getting 0 records.. is there any thing missing..

how to get records..

please any one help me.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

hey there,

can you talk through REST to your ES cluster, if so can you paste the
request and the response? I am kind of confused to see some discovery
settings in you client setup, can you try removing all these settings for
now?
Anyway, you are using termQuery which is not analyzed or processed, this is
likely not what you want, can you try matchQuery instead?

simon

On Monday, March 11, 2013 10:19:20 AM UTC+1, srikanth gone wrote:

Hi All,

This is my code..
Settings settings = ImmutableSettings.settingsBuilder()
.put("http.enabled", "false")
.put("transport.tcp.port", "9300-9400")
.put("discovery.zen.ping.multicast.enabled", "false")
.put("discovery.zen.ping.unicast.hosts", "localhost").build();

Node node =
NodeBuilder.nodeBuilder().client(true).settings(settings).clusterName("elasticsearch").node();
client = node.client();

    QueryBuilder queryBuilder = QueryBuilders.termQuery("userName", 

"SampleUser");
SearchRequestBuilder searchRequestBuilder =
client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_AND_FETCH);
searchRequestBuilder.setQuery(queryBuilder);
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp = searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output :
{
"took" : 32,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am getting 0 records.. is there any thing missing..

how to get records..

please any one help me.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

this is my code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();
    SearchRequestBuilder searchRequestBuilder = 

client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.QUERY_AND_FETCH);
searchRequestBuilder.setQuery(QueryBuilders.fuzzyQuery("userName",
"SampleUser"));
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp = searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output:

{
"took" : 235,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to use the QueryBuilders.matchQuery() method.. is there any
jars required.?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

hey,

does you index exists at all? can you provide some more infos?
you don't need any additional jars for match queyr, which version are you
using?
simon

On Monday, March 11, 2013 11:31:18 AM UTC+1, srikanth gone wrote:

this is my code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();
    SearchRequestBuilder searchRequestBuilder = 

client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.QUERY_AND_FETCH);
searchRequestBuilder.setQuery(QueryBuilders.fuzzyQuery("userName",
"SampleUser"));
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp = searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output:

{
"took" : 235,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to use the QueryBuilders.matchQuery() method.. is there any
jars required.?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

elastic server version is 0.19.8
On Monday, March 11, 2013 5:18:53 PM UTC+5:30, simonw wrote:

hey,

does you index exists at all? can you provide some more infos?
you don't need any additional jars for match queyr, which version are you
using?
simon

On Monday, March 11, 2013 11:31:18 AM UTC+1, srikanth gone wrote:

this is my code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();
    SearchRequestBuilder searchRequestBuilder = 

client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.QUERY_AND_FETCH);

searchRequestBuilder.setQuery(QueryBuilders.fuzzyQuery("userName",
"SampleUser"));
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp = searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output:

{
"took" : 235,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to use the QueryBuilders.matchQuery() method.. is there
any jars required.?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

On Monday, March 11, 2013 12:58:44 PM UTC+1, srikanth gone wrote:

elastic server version is 0.19.8

then use textQuery

but answer all my other qeustions before please

simon

On Monday, March 11, 2013 5:18:53 PM UTC+5:30, simonw wrote:

hey,

does you index exists at all? can you provide some more infos?
you don't need any additional jars for match queyr, which version are you
using?
simon

On Monday, March 11, 2013 11:31:18 AM UTC+1, srikanth gone wrote:

this is my code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();
    SearchRequestBuilder searchRequestBuilder = 

client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.QUERY_AND_FETCH);

searchRequestBuilder.setQuery(QueryBuilders.fuzzyQuery("userName",
"SampleUser"));
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp = searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output:

{
"took" : 235,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to use the QueryBuilders.matchQuery() method.. is there
any jars required.?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

hi simonw,
ya. actually i have created indexes using curl.. like this..

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}

is there any mapping missed..

On Monday, March 11, 2013 5:34:53 PM UTC+5:30, simonw wrote:

On Monday, March 11, 2013 12:58:44 PM UTC+1, srikanth gone wrote:

elastic server version is 0.19.8

then use textQuery

but answer all my other qeustions before please

simon

On Monday, March 11, 2013 5:18:53 PM UTC+5:30, simonw wrote:

hey,

does you index exists at all? can you provide some more infos?
you don't need any additional jars for match queyr, which version are
you using?
simon

On Monday, March 11, 2013 11:31:18 AM UTC+1, srikanth gone wrote:

this is my code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();
    SearchRequestBuilder searchRequestBuilder = 

client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.QUERY_AND_FETCH);

searchRequestBuilder.setQuery(QueryBuilders.fuzzyQuery("userName",
"SampleUser"));
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp =
searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output:

{
"took" : 235,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to use the QueryBuilders.matchQuery() method.. is there
any jars required.?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

actually i am using mongodb as database. how to create indexs for tables
at a time.

is there any api is there in java..

On Monday, March 11, 2013 5:57:39 PM UTC+5:30, srikanth gone wrote:

hi simonw,
ya. actually i have created indexes using curl.. like this..

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}

is there any mapping missed..

On Monday, March 11, 2013 5:34:53 PM UTC+5:30, simonw wrote:

On Monday, March 11, 2013 12:58:44 PM UTC+1, srikanth gone wrote:

elastic server version is 0.19.8

then use textQuery

but answer all my other qeustions before please

simon

On Monday, March 11, 2013 5:18:53 PM UTC+5:30, simonw wrote:

hey,

does you index exists at all? can you provide some more infos?
you don't need any additional jars for match queyr, which version are
you using?
simon

On Monday, March 11, 2013 11:31:18 AM UTC+1, srikanth gone wrote:

this is my code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();
    SearchRequestBuilder searchRequestBuilder = 

client.prepareSearch("_river");
searchRequestBuilder.setTypes("dc_user_river");
searchRequestBuilder.setSearchType(SearchType.QUERY_AND_FETCH);

searchRequestBuilder.setQuery(QueryBuilders.fuzzyQuery("userName",
"SampleUser"));
searchRequestBuilder.setFrom(0).setSize(60).setExplain(true);
SearchResponse resp =
searchRequestBuilder.execute().actionGet();
System.out.println(resp);
for (SearchHit hit : resp.getHits())
System.out.println("Hit ID: "+hit.getId());
node.close();

output:

{
"took" : 235,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to use the QueryBuilders.matchQuery() method.. is there
any jars required.?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

hi simonw,

if i use this code..

SearchResponse response = client.prepareSearch().execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
}

i am getting this output.

{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 91,
"successful" : 91,
"failed" : 0
},
"hits" : {
"total" : 122,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "data-collection.DC_DEMO_GROUP",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_provider_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PROVIDER"
}, "index": { "name": "dc_provider_idx", "type":
"DC_PROVIDER" }}
}, {
"_index" : "_river",
"_type" : "dc_practice_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PRACTICE"
}, "index": { "name": "dc_practice_idx", "type":
"DC_PRACTICE" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_PATIENT_TOPIC_DATA" }, "index": { "name":
"dc_patient_topic_data_idx", "type": "DC_PATIENT_TOPIC_DATA" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PATIENT"
}, "index": { "name": "dc_patient_idx", "type":
"DC_PATIENT" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_jursidiction_river",
"_id" : "data-collection.DC_DEMO_JURISDICTION",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_demo_rule_metadata_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_RULES_METADATA" }, "index": { "name":
"dc_rule_metadata_idx", "type": "DC_RULES_METADATA" }}
}, {
"_index" : "_river",
"_type" : "dc_role_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_ROLE" },
"index": { "name": "dc_role_idx", "type": "DC_ROLE" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_DEMO_GROUP"
}, "index": { "name": "dc_demo_group_idx", "type":
"DC_DEMO_GROUP" }}
}, {
"_index" : "_river",
"_type" : "dc_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_TOPIC" },
"index": { "name": "dc_topic_idx", "type": "DC_TOPIC" }}
} ]
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

ok so are you sure you have a 'dc_user_river' type?

what happens if your remove the query entirely and just filter by the
'dc_user_river' type?

simon

On Monday, March 11, 2013 1:59:22 PM UTC+1, srikanth gone wrote:

hi simonw,

if i use this code..

SearchResponse response = client.prepareSearch().execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
}

i am getting this output.

{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 91,
"successful" : 91,
"failed" : 0
},
"hits" : {
"total" : 122,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "data-collection.DC_DEMO_GROUP",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_provider_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PROVIDER"
}, "index": { "name": "dc_provider_idx", "type":
"DC_PROVIDER" }}
}, {
"_index" : "_river",
"_type" : "dc_practice_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PRACTICE"
}, "index": { "name": "dc_practice_idx", "type":
"DC_PRACTICE" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_PATIENT_TOPIC_DATA" }, "index": { "name":
"dc_patient_topic_data_idx", "type": "DC_PATIENT_TOPIC_DATA" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PATIENT"
}, "index": { "name": "dc_patient_idx", "type":
"DC_PATIENT" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_jursidiction_river",
"_id" : "data-collection.DC_DEMO_JURISDICTION",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_demo_rule_metadata_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_RULES_METADATA" }, "index": { "name":
"dc_rule_metadata_idx", "type": "DC_RULES_METADATA" }}
}, {
"_index" : "_river",
"_type" : "dc_role_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_ROLE" },
"index": { "name": "dc_role_idx", "type": "DC_ROLE" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_DEMO_GROUP"
}, "index": { "name": "dc_demo_group_idx", "type":
"DC_DEMO_GROUP" }}
}, {
"_index" : "_river",
"_type" : "dc_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_TOPIC" },
"index": { "name": "dc_topic_idx", "type": "DC_TOPIC" }}
} ]
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

i did like this..

SearchResponse response =
client.prepareSearch().setIndices("_river").setTypes("dc_user_river").execute().actionGet();

output is
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_USER" },
"index": { "name": "dc_user_idx", "type": "DC_USER" }}
}, {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_status",
"_score" : 1.0, "_source" :
{"ok":true,"node":{"id":"Snvd2nvCQB-4hpKUvMQtqA","name":"Jaeger","transport_address":"inet[/192.168.10.2:9300]"}}
} ]
}
}

On Monday, March 11, 2013 6:34:34 PM UTC+5:30, simonw wrote:

ok so are you sure you have a 'dc_user_river' type?

what happens if your remove the query entirely and just filter by the
'dc_user_river' type?

simon

On Monday, March 11, 2013 1:59:22 PM UTC+1, srikanth gone wrote:

hi simonw,

if i use this code..

SearchResponse response = client.prepareSearch().execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
}

i am getting this output.

{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 91,
"successful" : 91,
"failed" : 0
},
"hits" : {
"total" : 122,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "data-collection.DC_DEMO_GROUP",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_provider_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PROVIDER"
}, "index": { "name": "dc_provider_idx", "type":
"DC_PROVIDER" }}
}, {
"_index" : "_river",
"_type" : "dc_practice_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PRACTICE"
}, "index": { "name": "dc_practice_idx", "type":
"DC_PRACTICE" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_PATIENT_TOPIC_DATA" }, "index": { "name":
"dc_patient_topic_data_idx", "type": "DC_PATIENT_TOPIC_DATA" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PATIENT"
}, "index": { "name": "dc_patient_idx", "type":
"DC_PATIENT" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_jursidiction_river",
"_id" : "data-collection.DC_DEMO_JURISDICTION",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_demo_rule_metadata_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_RULES_METADATA" }, "index": { "name":
"dc_rule_metadata_idx", "type": "DC_RULES_METADATA" }}
}, {
"_index" : "_river",
"_type" : "dc_role_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_ROLE" },
"index": { "name": "dc_role_idx", "type": "DC_ROLE" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_DEMO_GROUP"
}, "index": { "name": "dc_demo_group_idx", "type":
"DC_DEMO_GROUP" }}
}, {
"_index" : "_river",
"_type" : "dc_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_TOPIC" },
"index": { "name": "dc_topic_idx", "type": "DC_TOPIC" }}
} ]
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,

Just jumping in this thread.

What are you trying to achieve?
Do you want to access to the river to to documents indexed by the river?

Can you describe a little bit what you are trying to do?
Also, have a look at: http://www.elasticsearch.org/guide/reference/java-api/
And https://github.com/elasticsearchfr/hands-on/tree/answers

To have some information on how to build requests using Java API.

Hope this help.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 14:50, srikanth gone srikanthg93@gmail.com a écrit :

i did like this..

SearchResponse response = client.prepareSearch().setIndices("_river").setTypes("dc_user_river").execute().actionGet();

output is
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_USER" }, "index": { "name": "dc_user_idx", "type": "DC_USER" }}
}, {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_status",
"_score" : 1.0, "_source" : {"ok":true,"node":{"id":"Snvd2nvCQB-4hpKUvMQtqA","name":"Jaeger","transport_address":"inet[/192.168.10.2:9300]"}}
} ]
}
}

On Monday, March 11, 2013 6:34:34 PM UTC+5:30, simonw wrote:
ok so are you sure you have a 'dc_user_river' type?

what happens if your remove the query entirely and just filter by the 'dc_user_river' type?

simon

On Monday, March 11, 2013 1:59:22 PM UTC+1, srikanth gone wrote:

hi simonw,

if i use this code..

SearchResponse response = client.prepareSearch().execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the document
result = hit.getSource(); //the retrieved document
}

i am getting this output.

{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 91,
"successful" : 91,
"failed" : 0
},
"hits" : {
"total" : 122,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "data-collection.DC_DEMO_GROUP",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" : 1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_provider_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PROVIDER" }, "index": { "name": "dc_provider_idx", "type": "DC_PROVIDER" }}
}, {
"_index" : "_river",
"_type" : "dc_practice_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PRACTICE" }, "index": { "name": "dc_practice_idx", "type": "DC_PRACTICE" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PATIENT_TOPIC_DATA" }, "index": { "name": "dc_patient_topic_data_idx", "type": "DC_PATIENT_TOPIC_DATA" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PATIENT" }, "index": { "name": "dc_patient_idx", "type": "DC_PATIENT" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_jursidiction_river",
"_id" : "data-collection.DC_DEMO_JURISDICTION",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" : 1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_demo_rule_metadata_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_RULES_METADATA" }, "index": { "name": "dc_rule_metadata_idx", "type": "DC_RULES_METADATA" }}
}, {
"_index" : "_river",
"_type" : "dc_role_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_ROLE" }, "index": { "name": "dc_role_idx", "type": "DC_ROLE" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_DEMO_GROUP" }, "index": { "name": "dc_demo_group_idx", "type": "DC_DEMO_GROUP" }}
}, {
"_index" : "_river",
"_type" : "dc_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_TOPIC" }, "index": { "name": "dc_topic_idx", "type": "DC_TOPIC" }}
} ]
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sorry.

Replace
Do you want to access to the river to to documents indexed by the river?

By
Do you want to access to the river OR to documents indexed by the river?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 14:53, David Pilato david@pilato.fr a écrit :

Hi,

Just jumping in this thread.

What are you trying to achieve?
Do you want to access to the river to to documents indexed by the river?

Can you describe a little bit what you are trying to do?
Also, have a look at: http://www.elasticsearch.org/guide/reference/java-api/
And https://github.com/elasticsearchfr/hands-on/tree/answers

To have some information on how to build requests using Java API.

Hope this help.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 14:50, srikanth gone srikanthg93@gmail.com a écrit :

i did like this..

SearchResponse response = client.prepareSearch().setIndices("_river").setTypes("dc_user_river").execute().actionGet();

output is
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_USER" }, "index": { "name": "dc_user_idx", "type": "DC_USER" }}
}, {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_status",
"_score" : 1.0, "_source" : {"ok":true,"node":{"id":"Snvd2nvCQB-4hpKUvMQtqA","name":"Jaeger","transport_address":"inet[/192.168.10.2:9300]"}}
} ]
}
}

On Monday, March 11, 2013 6:34:34 PM UTC+5:30, simonw wrote:
ok so are you sure you have a 'dc_user_river' type?

what happens if your remove the query entirely and just filter by the 'dc_user_river' type?

simon

On Monday, March 11, 2013 1:59:22 PM UTC+1, srikanth gone wrote:

hi simonw,

if i use this code..

SearchResponse response = client.prepareSearch().execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the document
result = hit.getSource(); //the retrieved document
}

i am getting this output.

{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 91,
"successful" : 91,
"failed" : 0
},
"hits" : {
"total" : 122,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "data-collection.DC_DEMO_GROUP",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" : 1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_provider_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PROVIDER" }, "index": { "name": "dc_provider_idx", "type": "DC_PROVIDER" }}
}, {
"_index" : "_river",
"_type" : "dc_practice_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PRACTICE" }, "index": { "name": "dc_practice_idx", "type": "DC_PRACTICE" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PATIENT_TOPIC_DATA" }, "index": { "name": "dc_patient_topic_data_idx", "type": "DC_PATIENT_TOPIC_DATA" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_PATIENT" }, "index": { "name": "dc_patient_idx", "type": "DC_PATIENT" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_jursidiction_river",
"_id" : "data-collection.DC_DEMO_JURISDICTION",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" : 1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_demo_rule_metadata_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_RULES_METADATA" }, "index": { "name": "dc_rule_metadata_idx", "type": "DC_RULES_METADATA" }}
}, {
"_index" : "_river",
"_type" : "dc_role_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_ROLE" }, "index": { "name": "dc_role_idx", "type": "DC_ROLE" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_DEMO_GROUP" }, "index": { "name": "dc_demo_group_idx", "type": "DC_DEMO_GROUP" }}
}, {
"_index" : "_river",
"_type" : "dc_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb": { "db": "data-collection", "collection": "DC_TOPIC" }, "index": { "name": "dc_topic_idx", "type": "DC_TOPIC" }}
} ]
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi David,
i am using mongodb as database. i want to search text using elasticsearch
in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

On Monday, March 11, 2013 7:23:48 PM UTC+5:30, David Pilato wrote:

Hi,

Just jumping in this thread.

What are you trying to achieve?
Do you want to access to the river to to documents indexed by the river?

Can you describe a little bit what you are trying to do?
Also, have a look at:
http://www.elasticsearch.org/guide/reference/java-api/
And https://github.com/elasticsearchfr/hands-on/tree/answers

To have some information on how to build requests using Java API.

Hope this help.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 mars 2013 à 14:50, srikanth gone <srika...@gmail.com <javascript:>>
a écrit :

i did like this..

SearchResponse response =
client.prepareSearch().setIndices("_river").setTypes("dc_user_river").execute().actionGet();

output is
{
"took" : 16,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_USER" },
"index": { "name": "dc_user_idx", "type": "DC_USER" }}
}, {
"_index" : "_river",
"_type" : "dc_user_river",
"_id" : "_status",
"_score" : 1.0, "_source" :
{"ok":true,"node":{"id":"Snvd2nvCQB-4hpKUvMQtqA","name":"Jaeger","transport_address":"inet[/
192.168.10.2:9300]"}}
} ]
}
}

On Monday, March 11, 2013 6:34:34 PM UTC+5:30, simonw wrote:

ok so are you sure you have a 'dc_user_river' type?

what happens if your remove the query entirely and just filter by the
'dc_user_river' type?

simon

On Monday, March 11, 2013 1:59:22 PM UTC+1, srikanth gone wrote:

hi simonw,

if i use this code..

SearchResponse response = client.prepareSearch().execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
}

i am getting this output.

{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 91,
"successful" : 91,
"failed" : 0
},
"hits" : {
"total" : 122,
"max_score" : 1.0,
"hits" : [ {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "data-collection.DC_DEMO_GROUP",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_provider_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PROVIDER"
}, "index": { "name": "dc_provider_idx", "type":
"DC_PROVIDER" }}
}, {
"_index" : "_river",
"_type" : "dc_practice_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PRACTICE"
}, "index": { "name": "dc_practice_idx", "type":
"DC_PRACTICE" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_PATIENT_TOPIC_DATA" }, "index": { "name":
"dc_patient_topic_data_idx", "type": "DC_PATIENT_TOPIC_DATA" }}
}, {
"_index" : "_river",
"_type" : "dc_patient_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_PATIENT"
}, "index": { "name": "dc_patient_idx", "type":
"DC_PATIENT" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_jursidiction_river",
"_id" : "data-collection.DC_DEMO_JURISDICTION",
"_score" : 1.0, "_source" : {"mongodb":{"_last_ts":"{ "$ts" :
1362465631 , "$inc" : 1}"}}
}, {
"_index" : "_river",
"_type" : "dc_demo_rule_metadata_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection":
"DC_RULES_METADATA" }, "index": { "name":
"dc_rule_metadata_idx", "type": "DC_RULES_METADATA" }}
}, {
"_index" : "_river",
"_type" : "dc_role_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_ROLE" },
"index": { "name": "dc_role_idx", "type": "DC_ROLE" }}
}, {
"_index" : "_river",
"_type" : "dc_demo_group_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_DEMO_GROUP"
}, "index": { "name": "dc_demo_group_idx", "type":
"DC_DEMO_GROUP" }}
}, {
"_index" : "_river",
"_type" : "dc_topic_river",
"_id" : "_meta",
"_score" : 1.0, "_source" : { "type": "mongodb", "mongodb":
{ "db": "data-collection", "collection": "DC_TOPIC" },
"index": { "name": "dc_topic_idx", "type": "DC_TOPIC" }}
} ]
}
}

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Let's do it step by step.

Try this:

SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "SampleUser")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

If it does not work, can you do:
curl "localhost:9200/dc_user_idx/_search?q=*&pretty"

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 15:11, srikanth gone srikanthg93@gmail.com a écrit :

Hi David,
i am using mongodb as database. i want to search text using elasticsearch in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi David,
i have tried what you have suggested. its working..
output is

{
"took" : 78,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 1,
"failed" : 4,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 2,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "dc_user_idx",
"_type" : "DC_USER",
"_id" : "1DQlnc2ZQD-QFzbhi3KNpg",
"_score" : 0.30685282, "_source" :
{"userName":"SampleUser","firstName":"SampleUser","lastName":"SampleUser"}
} ]
}
}

when i am i have change the text, i.e instead of SampleUser, i have use
NormalUser, its not fetch data.. but record is there in db.

On Monday, March 11, 2013 8:09:40 PM UTC+5:30, David Pilato wrote:

Let's do it step by step.

Try this:

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

If it does not work, can you do:
curl "localhost:9200/dc_user_idx/_search?q=*&pretty"

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 mars 2013 à 15:11, srikanth gone <srika...@gmail.com <javascript:>>
a écrit :

Hi David,
i am using mongodb as database. i want to search text using elasticsearch
in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You have 4 failing shards. Perhaps the document you are looking for is in one of theses shards.
You should try to have a yellow cluster before searching in it.

Try to restart from scratch.

curl -XDELETE http://localhost:9200/

WARNING: it will delete all your indexes and rivers.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 16:25, srikanth gone srikanthg93@gmail.com a écrit :

Hi David,
i have tried what you have suggested. its working..
output is

{
"took" : 78,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 1,
"failed" : 4,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 2,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "dc_user_idx",
"_type" : "DC_USER",
"_id" : "1DQlnc2ZQD-QFzbhi3KNpg",
"_score" : 0.30685282, "_source" : {"userName":"SampleUser","firstName":"SampleUser","lastName":"SampleUser"}
} ]
}
}

when i am i have change the text, i.e instead of SampleUser, i have use NormalUser, its not fetch data.. but record is there in db.

On Monday, March 11, 2013 8:09:40 PM UTC+5:30, David Pilato wrote:
Let's do it step by step.

Try this:

SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "SampleUser")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

If it does not work, can you do:
curl "localhost:9200/dc_user_idx/_search?q=*&pretty"

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 15:11, srikanth gone srika...@gmail.com a écrit :

Hi David,
i am using mongodb as database. i want to search text using elasticsearch in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi David..
i have deleted curl.. and restarted.
i have replaced text like this..
SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"Ashok")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

output..but already record is there
{
"took" : 578,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 3,
"failed" : 2,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

please help me

On Monday, March 11, 2013 8:58:24 PM UTC+5:30, David Pilato wrote:

You have 4 failing shards. Perhaps the document you are looking for is in
one of theses shards.
You should try to have a yellow cluster before searching in it.

Try to restart from scratch.

curl -XDELETE http://localhost:9200/

WARNING: it will delete all your indexes and rivers.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 mars 2013 à 16:25, srikanth gone <srika...@gmail.com <javascript:>>
a écrit :

Hi David,
i have tried what you have suggested. its working..
output is

{
"took" : 78,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 1,
"failed" : 4,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 2,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "dc_user_idx",
"_type" : "DC_USER",
"_id" : "1DQlnc2ZQD-QFzbhi3KNpg",
"_score" : 0.30685282, "_source" :
{"userName":"SampleUser","firstName":"SampleUser","lastName":"SampleUser"}
} ]
}
}

when i am i have change the text, i.e instead of SampleUser, i have use
NormalUser, its not fetch data.. but record is there in db.

On Monday, March 11, 2013 8:09:40 PM UTC+5:30, David Pilato wrote:

Let's do it step by step.

Try this:

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

If it does not work, can you do:
curl "localhost:9200/dc_user_idx/_search?q=*&pretty"

--
David Pilato | Technical Advocate | *Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 mars 2013 à 15:11, srikanth gone srika...@gmail.com a écrit :

Hi David,
i am using mongodb as database. i want to search text using
elasticsearch in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sounds like you are creating index in Java, don't you?
If so, wait for a yellow cluster before creating the river and searching for anything.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 11 mars 2013 à 17:17, srikanth gone srikanthg93@gmail.com a écrit :

Hi David..
i have deleted curl.. and restarted.
i have replaced text like this..
SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "Ashok")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

output..but already record is there
{
"took" : 578,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 3,
"failed" : 2,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

please help me

On Monday, March 11, 2013 8:58:24 PM UTC+5:30, David Pilato wrote:

You have 4 failing shards. Perhaps the document you are looking for is in one of theses shards.
You should try to have a yellow cluster before searching in it.

Try to restart from scratch.

curl -XDELETE http://localhost:9200/

WARNING: it will delete all your indexes and rivers.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 16:25, srikanth gone srika...@gmail.com a écrit :

Hi David,
i have tried what you have suggested. its working..
output is

{
"took" : 78,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 1,
"failed" : 4,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 2,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "dc_user_idx",
"_type" : "DC_USER",
"_id" : "1DQlnc2ZQD-QFzbhi3KNpg",
"_score" : 0.30685282, "_source" : {"userName":"SampleUser","firstName":"SampleUser","lastName":"SampleUser"}
} ]
}
}

when i am i have change the text, i.e instead of SampleUser, i have use NormalUser, its not fetch data.. but record is there in db.

On Monday, March 11, 2013 8:09:40 PM UTC+5:30, David Pilato wrote:

Let's do it step by step.

Try this:

SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "SampleUser")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

If it does not work, can you do:
curl "localhost:9200/dc_user_idx/_search?q=*&pretty"

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 11 mars 2013 à 15:11, srikanth gone srika...@gmail.com a écrit :

Hi David,
i am using mongodb as database. i want to search text using elasticsearch in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName", "SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

HI David, i have created indexes using CURL in one batch file.(.bat)

curl -XPUT "http://localhost:9200/_river/dc_user_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
like this ..

On Monday, March 11, 2013 9:55:14 PM UTC+5:30, David Pilato wrote:

Sounds like you are creating index in Java, don't you?
If so, wait for a yellow cluster before creating the river and searching
for anything.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 11 mars 2013 à 17:17, srikanth gone <srika...@gmail.com <javascript:>>
a écrit :

Hi David..
i have deleted curl.. and restarted.
i have replaced text like this..
SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"Ashok")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

output..but already record is there
{
"took" : 578,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 3,
"failed" : 2,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

please help me

On Monday, March 11, 2013 8:58:24 PM UTC+5:30, David Pilato wrote:

You have 4 failing shards. Perhaps the document you are looking for is in
one of theses shards.
You should try to have a yellow cluster before searching in it.

Try to restart from scratch.

curl -XDELETE http://localhost:9200/

WARNING: it will delete all your indexes and rivers.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 mars 2013 à 16:25, srikanth gone srika...@gmail.com a écrit :

Hi David,
i have tried what you have suggested. its working..
output is

{
"took" : 78,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 1,
"failed" : 4,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 1,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 2,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "dc_user_idx",
"_type" : "DC_USER",
"_id" : "1DQlnc2ZQD-QFzbhi3KNpg",
"_score" : 0.30685282, "_source" :
{"userName":"SampleUser","firstName":"SampleUser","lastName":"SampleUser"}
} ]
}
}

when i am i have change the text, i.e instead of SampleUser, i have use
NormalUser, its not fetch data.. but record is there in db.

On Monday, March 11, 2013 8:09:40 PM UTC+5:30, David Pilato wrote:

Let's do it step by step.

Try this:

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("dc_user_idx").setTypes("DC_USER").execute().actionGet();

If it does not work, can you do:
curl "localhost:9200/dc_user_idx/_search?q=*&pretty"

--
David Pilato | Technical Advocate | *Elasticsearch.comhttp://elasticsearch.com/
*
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr
| @scrutmydocs https://twitter.com/scrutmydocs

Le 11 mars 2013 à 15:11, srikanth gone srika...@gmail.com a écrit :

Hi David,
i am using mongodb as database. i want to search text using
elasticsearch in java.

this is my xml configuration

<elasticsearch:node id="esNode" />
<elasticsearch:client node="esNode" id="esClient" />

properties file is:

cluster.name=dc-cluster
name=junit.node

Disable network

discovery.zen.ping.multicast.enabled=false
node.local=true

Using less filesystem as possible

index.store.type=memory
index.store.fs.memory.enabled=true
index.gateway.type=none
gateway.type=none

If ES needs to write something, it's here

path.data=es/twitter

Index are minimalists by default

index.number_of_shards=1
index.number_of_replicas=0

using curl i am trying to create indexes

curl -XPUT "http://localhost:9200/_river/dc_role_river/_meta" -d {
"type": "mongodb",
"mongodb": {
"db": "data-collection",
"collection": "DC_USER"
},
"index": {
"name": "dc_user_idx",
"type": "DC_USER"
}
}
this is my java code..

Node node = null;
node = NodeBuilder.nodeBuilder().node();

    Client client = node.client();

SearchResponse response =
client.prepareSearch().setQuery(QueryBuilders.textQuery("firstName",
"SampleUser")).setIndices("_river").setTypes("dc_user_river").execute().actionGet();

System.out.println(response);
SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the
document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

out put is:

{
"took" : 281,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

i am not able to get the data.

please help me.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.