Little problem


(Jeremy TYRIAUX) #1

Hello,

i have a little problem with elastic search :

My doc looks like : (serialized as JSON doc)


Brandon
10


Monica
14

My search request :
{
"fields": ["user.age"],
"query": {
"bool" : {
"must" :
{ "multi_match" : {
"query" : "Brandon",
"fields" : [ ".name.$"] }
}
}
}
}

I got : 10 and 14 as result (all fields user.age in the doc)

I only want to get 14 ( the age of brandon)
Can we only get the field about the search field ?

( sorry for my english, i'm not ! :stuck_out_tongue: )

sorry for double post, i not subscibe first time....

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ca65dff4-cd98-41b3-a098-e9e59dda1f5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ivan Brusic) #2

The only way to achieve the result you are seeking is to use parent/child
documents:


http://www.spacevatican.org/2012/6/3/fun-with-elasticsearch-s-children-and-nested-documents/

Cheers,

Ivan

On Mon, Aug 4, 2014 at 9:10 AM, Jeremy TYRIAUX drezounet@gmail.com wrote:

Hello,

i have a little problem with elastic search :

My doc looks like : (serialized as JSON doc)


Brandon
10


Monica
14

My search request :
{
"fields": ["user.age"],
"query": {
"bool" : {
"must" :
{ "multi_match" : {
"query" : "Brandon",
"fields" : [ ".name.$"] }
}
}
}
}

I got : 10 and 14 as result (all fields user.age in the doc)

I only want to get 14 ( the age of brandon)
Can we only get the field about the search field ?

( sorry for my english, i'm not ! :stuck_out_tongue: )

sorry for double post, i not subscibe first time....

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ca65dff4-cd98-41b3-a098-e9e59dda1f5f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/ca65dff4-cd98-41b3-a098-e9e59dda1f5f%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDkr1VfskWZsoFUcjuAfq%3D5_8iVPRF7yM3dBJFiAYwxWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Jeremy) #3

thanks for the reply.

i divided the problem in a new index with only user structure.

now it's functionnaly.

Thanks to you Ivan.

Jeremy.


(system) #4