How to implement JSON for searching data from elasticsearch

Hello all,

i am new to elasticsearch and lucene.

i have following json string that i want to get parse from elastic search.

{
"fields": [
"email",
"firstName",
"lastName"
],

"query": {
"query_string": {
"fields": [
"email","firstName","email"
],
"query": "Jelena @gmail.com",
"use_dis_max": true
}
}
}

just want to know the method to pass this string to java api.
any sample code in java api will be much appreciated.

Thanks in advanced
Mohsin

--

Have a look here: GitHub - elasticsearchfr/hands-on: Hands On Lab

It should help you to start.
Answers are in answers branch: GitHub - elasticsearchfr/hands-on at answers

HTH

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

Le 1 nov. 2012 à 13:43, mohsin husen smhdiu@gmail.com a écrit :

Hello all,

i am new to elasticsearch and lucene.

i have following json string that i want to get parse from Elasticsearch.

{
"fields": [
"email",
"firstName",
"lastName"
],

"query": {
"query_string": {
"fields": [
"email","firstName","email"
],
"query": "Jelena @gmail.com",
"use_dis_max": true
}
}
}

just want to know the method to pass this string to java api.
any sample code in java api will be much appreciated.

Thanks in advanced
Mohsin

--

--

That helped me a lot.
Thanks David.

i now know how to search the data.
now once i have the SearchResponce how can i get my fields?
i.e can i get a list of values ?

thanks in adavnced
mohsin

On Thursday, 1 November 2012 13:36:18 UTC, David Pilato wrote:

Have a look here: GitHub - elasticsearchfr/hands-on: Hands On Lab

It should help you to start.
Answers are in answers branch:
GitHub - elasticsearchfr/hands-on at answers

HTH

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

Le 1 nov. 2012 à 13:43, mohsin husen <smh...@gmail.com <javascript:>> a
écrit :

Hello all,

i am new to elasticsearch and lucene.

i have following json string that i want to get parse from Elasticsearch.

{
"fields": [
"email",
"firstName",
"lastName"
],

"query": {
"query_string": {
"fields": [
"email","firstName","email"
],
"query": "Jelena @gmail.com",
"use_dis_max": true
}
}
}

just want to know the method to pass this string to java api.
any sample code in java api will be much appreciated.

Thanks in advanced
Mohsin

--

--

Look here: https://github.com/elasticsearchfr/hands-on/blob/answers/src/test/java/org/elasticsearchfr/handson/ex2/SearchTest.java#L268
You get all hits and you can use Jackson to deserialize hits to your javabeans.

See also: Hands on lab Elasticsearch | PPT
Althought it's in french, you can understand some code.

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

Le 1 nov. 2012 à 15:23, mohsin husen smhdiu@gmail.com a écrit :

That helped me a lot.
Thanks David.

i now know how to search the data.
now once i have the SearchResponce how can i get my fields?
i.e can i get a list of values ?

thanks in adavnced
mohsin

On Thursday, 1 November 2012 13:36:18 UTC, David Pilato wrote:

Have a look here: GitHub - elasticsearchfr/hands-on: Hands On Lab

It should help you to start.
Answers are in answers branch: GitHub - elasticsearchfr/hands-on at answers

HTH

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

Le 1 nov. 2012 à 13:43, mohsin husen smh...@gmail.com a écrit :

Hello all,

i am new to elasticsearch and lucene.

i have following json string that i want to get parse from Elasticsearch.

{
"fields": [
"email",
"firstName",
"lastName"
],

"query": {
"query_string": {
"fields": [
"email","firstName","email"
],
"query": "Jelena @gmail.com",
"use_dis_max": true
}
}
}

just want to know the method to pass this string to java api.
any sample code in java api will be much appreciated.

Thanks in advanced
Mohsin

--

--

--

It has answer to all my question
Cheers !
Thanks a ton David !

Mohsin

On Thursday, 1 November 2012 14:43:15 UTC, David Pilato wrote:

Look here:
https://github.com/elasticsearchfr/hands-on/blob/answers/src/test/java/org/elasticsearchfr/handson/ex2/SearchTest.java#L268
You get all hits and you can use Jackson to deserialize hits to your
javabeans.

See also:
Hands on lab Elasticsearch | PPT
Althought it's in french, you can understand some code.

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

Le 1 nov. 2012 à 15:23, mohsin husen <smh...@gmail.com <javascript:>> a
écrit :

That helped me a lot.
Thanks David.

i now know how to search the data.
now once i have the SearchResponce how can i get my fields?
i.e can i get a list of values ?

thanks in adavnced
mohsin

On Thursday, 1 November 2012 13:36:18 UTC, David Pilato wrote:

Have a look here: GitHub - elasticsearchfr/hands-on: Hands On Lab

It should help you to start.
Answers are in answers branch:
GitHub - elasticsearchfr/hands-on at answers

HTH

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

Le 1 nov. 2012 à 13:43, mohsin husen smh...@gmail.com a écrit :

Hello all,

i am new to elasticsearch and lucene.

i have following json string that i want to get parse from Elasticsearch.

{
"fields": [
"email",
"firstName",
"lastName"
],

"query": {
"query_string": {
"fields": [
"email","firstName","email"
],
"query": "Jelena @gmail.com",
"use_dis_max": true
}
}
}

just want to know the method to pass this string to java api.
any sample code in java api will be much appreciated.

Thanks in advanced
Mohsin

--

--

--