How to search text using java elastic search

hi David, i have cleaned mongo Database and elastic server data folder..

and restarted server.. created 5 records in DC_USER table..

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

when i call this query its not fetching data..

the output is:

{
"took" : 47,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 2,
"failed" : 3,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 4,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
how to resolve this problem..

On Tuesday, March 12, 2013 11:47:00 AM UTC+5:30, srikanth gone wrote:

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 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.
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.

Ok. Follow theses steps:

curl -XDELETE http://localhost:9200/

curl -XPUT 'http://localhost:9200/dc_user_idx' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

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"
}
}

curl 'http://localhost:9200/_cluster/health?pretty=true'

Your cluster should be "status":"green" (or at least yellow - due to the river).
If not yellow or green, try to have a clean and fresh installation of your elasticsearch.

One more question: are you running more than one node?

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

Le 12 mars 2013 à 08:07, srikanth gone srikanthg93@gmail.com a écrit :

hi David, i have cleaned mongo Database and elastic server data folder..

and restarted server.. created 5 records in DC_USER table..

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

when i call this query its not fetching data..

the output is:

{
"took" : 47,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 2,
"failed" : 3,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 4,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
how to resolve this problem..

On Tuesday, March 12, 2013 11:47:00 AM UTC+5:30, srikanth gone wrote:
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 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 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,

Thanks you very much.. its working fine.. i have configured new elastic
search..

how to search text without specifying fieldName.. which method is
better.. can you suggest me..

On Tuesday, March 12, 2013 2:46:32 PM UTC+5:30, David Pilato wrote:

Ok. Follow theses steps:

curl -XDELETE http://localhost:9200/

curl -XPUT 'http://localhost:9200/dc_user_idx' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

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"
}
}

curl 'http://localhost:9200/_cluster/health?pretty=true'

Your cluster should be "status":"green" (or at least yellow - due to the
river).
If not yellow or green, try to have a clean and fresh installation of your
elasticsearch.

One more question: are you running more than one node?

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

Le 12 mars 2013 à 08:07, srikanth gone <srika...@gmail.com <javascript:>>
a écrit :

hi David, i have cleaned mongo Database and elastic server data folder..

and restarted server.. created 5 records in DC_USER table..

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

when i call this query its not fetching data..

the output is:

{
"took" : 47,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 2,
"failed" : 3,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 4,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
how to resolve this problem..

On Tuesday, March 12, 2013 11:47:00 AM UTC+5:30, srikanth gone wrote:

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 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.comhttp://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.
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.

Use queryString: Elasticsearch Platform — Find real-time answers at scale | Elastic
It will search by default in the default _all field.

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

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

Hi David,

Thanks you very much.. its working fine.. i have configured new Elasticsearch..

how to search text without specifying fieldName.. which method is better.. can you suggest me..

On Tuesday, March 12, 2013 2:46:32 PM UTC+5:30, David Pilato wrote:
Ok. Follow theses steps:

curl -XDELETE http://localhost:9200/

curl -XPUT 'http://localhost:9200/dc_user_idx' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

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"
}
}

curl 'http://localhost:9200/_cluster/health?pretty=true'

Your cluster should be "status":"green" (or at least yellow - due to the river).
If not yellow or green, try to have a clean and fresh installation of your elasticsearch.

One more question: are you running more than one node?

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

Le 12 mars 2013 à 08:07, srikanth gone srika...@gmail.com a écrit :

hi David, i have cleaned mongo Database and elastic server data folder..

and restarted server.. created 5 records in DC_USER table..

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

when i call this query its not fetching data..

the output is:

{
"took" : 47,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 2,
"failed" : 3,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 4,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
how to resolve this problem..

On Tuesday, March 12, 2013 11:47:00 AM UTC+5:30, srikanth gone wrote:
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 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 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.
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.

thank you David..

for example if i have 2 users SampleUser, SampleUser1..
if i send text as Sample, is it fetching data? or can i provide Sample* ?

On Tuesday, March 12, 2013 4:01:25 PM UTC+5:30, David Pilato wrote:

Use queryString:
Elasticsearch Platform — Find real-time answers at scale | Elastic
It will search by default in the default _all field.

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

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

Hi David,

Thanks you very much.. its working fine.. i have configured new elastic
search..

how to search text without specifying fieldName.. which method is
better.. can you suggest me..

On Tuesday, March 12, 2013 2:46:32 PM UTC+5:30, David Pilato wrote:

Ok. Follow theses steps:

curl -XDELETE http://localhost:9200/

curl -XPUT 'http://localhost:9200/dc_user_idx' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

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"
}
}

curl 'http://localhost:9200/_cluster/health?pretty=true'

Your cluster should be "status":"green" (or at least yellow - due to the
river).
If not yellow or green, try to have a clean and fresh installation of
your elasticsearch.

One more question: are you running more than one node?

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

Le 12 mars 2013 à 08:07, srikanth gone srika...@gmail.com a écrit :

hi David, i have cleaned mongo Database and elastic server data folder..

and restarted server.. created 5 records in DC_USER table..

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

when i call this query its not fetching data..

the output is:

{
"took" : 47,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 2,
"failed" : 3,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 4,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
how to resolve this problem..

On Tuesday, March 12, 2013 11:47:00 AM UTC+5:30, srikanth gone wrote:

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 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.comhttp://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.
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.
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.

Now you have everything running to start to play with Elasticsearch.

I suggest that you read the documentation about queries (Elasticsearch Platform — Find real-time answers at scale | Elastic) and so on, that you look at some videos (Elasticsearch Platform — Find real-time answers at scale | Elastic)…
Also, have a look at some old slides here: Elasticsearch - Devoxx France 2012 - English version | PPT

Then, when you have questions (query that does not give the expected results for example), follow instructions on that page: Elasticsearch Platform — Find real-time answers at scale | Elastic
And please open a new Thread with your concrete problem.

About Java, you can find some documentation here: http://www.elasticsearch.org/guide/reference/java-api/

HTH

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

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

thank you David..

for example if i have 2 users SampleUser, SampleUser1..
if i send text as Sample, is it fetching data? or can i provide Sample* ?

On Tuesday, March 12, 2013 4:01:25 PM UTC+5:30, David Pilato wrote:
Use queryString: Elasticsearch Platform — Find real-time answers at scale | Elastic
It will search by default in the default _all field.

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

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

Hi David,

Thanks you very much.. its working fine.. i have configured new Elasticsearch..

how to search text without specifying fieldName.. which method is better.. can you suggest me..

On Tuesday, March 12, 2013 2:46:32 PM UTC+5:30, David Pilato wrote:
Ok. Follow theses steps:

curl -XDELETE http://localhost:9200/

curl -XPUT 'http://localhost:9200/dc_user_idx' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
}'

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"
}
}

curl 'http://localhost:9200/_cluster/health?pretty=true'

Your cluster should be "status":"green" (or at least yellow - due to the river).
If not yellow or green, try to have a clean and fresh installation of your elasticsearch.

One more question: are you running more than one node?

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

Le 12 mars 2013 à 08:07, srikanth gone srika...@gmail.com a écrit :

hi David, i have cleaned mongo Database and elastic server data folder..

and restarted server.. created 5 records in DC_USER table..

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

when i call this query its not fetching data..

the output is:

{
"took" : 47,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 2,
"failed" : 3,
"failures" : [ {
"index" : "dc_user_idx",
"shard" : 0,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 3,
"status" : 500,
"reason" : "No active shards"
}, {
"index" : "dc_user_idx",
"shard" : 4,
"status" : 500,
"reason" : "No active shards"
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}
how to resolve this problem..

On Tuesday, March 12, 2013 11:47:00 AM UTC+5:30, srikanth gone wrote:
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 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 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.
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.
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.