Matching on sibling json nodes?


(Kristian Rosenvold) #1

We're submitting a json document that looks like this:

{
"book": {
"title" : "book1",
"authors": [
{"name":"auth1", "role":"role1"},
{"name":"auth2", "role":"role2"}
]
}
}

We would like to do searches that find this for a search on auth1/role1 but
not for auth1/role2. We have used nested queries to make this work, but
unfortunately nested queries dont work with highlighting. Is there any
other way to accomplish this ? (We are contemplating simply filing a new
field that combines name and role, but that would also have some drawbacks).

Kristian

--
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/0b062a6d-5766-4dee-96a5-27aff637f56b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Clinton Gormley) #2

Hi Kristian

You can use nested objects and set "include_in_parent" to true (it's like
using type:nested and type:object on the same field), then highlight on the
fields in the parent object.

clint

On 12 May 2014 13:42, Kristian Rosenvold kristian.rosenvold@gmail.comwrote:

We're submitting a json document that looks like this:

{
"book": {
"title" : "book1",
"authors": [
{"name":"auth1", "role":"role1"},
{"name":"auth2", "role":"role2"}
]
}
}

We would like to do searches that find this for a search on auth1/role1
but not for auth1/role2. We have used nested queries to make this work,
but unfortunately nested queries dont work with highlighting. Is there any
other way to accomplish this ? (We are contemplating simply filing a new
field that combines name and role, but that would also have some drawbacks).

Kristian

--
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/0b062a6d-5766-4dee-96a5-27aff637f56b%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/0b062a6d-5766-4dee-96a5-27aff637f56b%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/CAPt3XKSJ%3Dq2-koCpKd3ALdyw9eHVfb0RRmDm3PwZ_Ln%2BZ0-UOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3