Sorting details


(Ahmed Sabaa) #1

Hello,

I am trying to sort a document using the locations attribute of a
subdocument with the following architecture.

{
attribute1: value1,
attribute2: value2,
attribute3: [{
attribute1: value1,
location: {
lat: latitude,
lon: longitude
}
}, {
attribute1: value1,
location: {
lat: latitude,
lon: longitude
}
}]
}, {
attribute1: value1,
attribute2: value2,
attribute3: [{
attribute1: value1,
location: {
lat: latitude,
lon: longitude
}
}, {
attribute1: value1,
location: {
lat: latitude,
lon: longitude
}
}]
}

So basically I have the location attribute indexed as a geo_point in the
mappings and I'm sorting the parent documents based on these values.
Strangely enough, it works just fine without any alterations to the
search/sort code but the problem is that I want to get which sub document
(inside the array) resulted in having it's parent document as the first (or
second or third) result so to have that as only sub document in the array.

I don't know if that's doable via elasticsearch directly (probably not) but
is there anyway to get some details about the sorting itself at run time to
do it at application level?

Regards,
Ahmed.

--
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/1d6bcf30-79f3-4ef7-9df9-e868806e2a5c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2