Has Parent and sorting on a parent's properties

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Has Parent and sorting on a parent's properties

Nick Hoffman
With a Has Parent filter or query, is there a way to sort on one or more of the parent's properties?

I've tried using a sorting script, but all of my attempts generated errors. E.g.
    "script": "doc._parent['number'].value",
    "script": "doc.parent['number'].value",

    "script": "doc['_parent']['number'].value",
    "script": "doc['parent']['number'].value",

Thanks!
Nick

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Has Parent and sorting on a parent's properties

Martijn v Groningen
This isn't possible via script sorting. However this possible via the custom_score query:

I'll need to include this query as inner query in the has_parent query.


On 23 July 2013 18:35, Nick Hoffman <[hidden email]> wrote:
With a Has Parent filter or query, is there a way to sort on one or more of the parent's properties?

I've tried using a sorting script, but all of my attempts generated errors. E.g.
    "script": "doc._parent['number'].value",
    "script": "doc.parent['number'].value",

    "script": "doc['_parent']['number'].value",
    "script": "doc['parent']['number'].value",

Thanks!
Nick

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Met vriendelijke groet,

Martijn van Groningen

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.