Ahhh, sorry - this is a change from the previous Perl API.
The search() method can take a sort parameter at the top level, which goes
into the query string, or inside the body. The query-string version is
somewhat limited, so the body version would look like this:
$es->search(
fields => ['message'],
size => $opt->{size},
body => {
sort => [ { event_time=>'desc'}]
}
)
clint
On 28 November 2013 17:29, Oliver B. Fischer mailsink@swe-blog.net wrote:
my $result = $es->search(fields => ['message'],
size => $opt->{'size'},
sort => [
{event_time => 'desc'}
]);
results in
[Failed to parse source [{"size":5,"fields":"message",
"sort":[{"HASH(0x7fc31382d3a0)":{}}]}]]]; nested: SearchParseException[[faststrack-2013.11.25][4]:
from[-1],size[5]: Parse Failure [No mapping found for
[HASH(0x7fc31382d3a0)] in order to sort on]]; }]'},'request' => {'body' =>
undef,'qs' => {'sort' => 'HASH(0x7fc31382d3a0)','fields' =>
'message','size' => 5},'method' => 'GET','serialize' => 'std','path' =>
'/_search','ignore' => },'status_code' => 400}
????
Am 28.11.13 17:12, schrieb Clinton Gormley:
sort => [ { event_time => 'desc'} ]
--
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/52976F4F.5080500%40swe-blog.net.
For more options, visit https://groups.google.com/groups/opt_out.
--
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/CAPt3XKRHYPhZ%3DyYHRH1o6SYmZuvaCcpDSeCaK2RMHqNQ8Z1G1g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.