Score and sorting in elastic search

(vallabh) #1

Dear All,

I want to display best possible results for search text such as san and $an.
I am following below code, where i am searching for san and $an, currently
in elasticsearch server i do have value stored as San Soda,San Cisco and so
I have replaced s with $, because we are searching in 2 ways. I wanted to
fetch the result related to san first on the top then for $an and rest in
the bottom as alphabetically but this is not happening with this code

$result = $es->search(array(
"query" => array(
"dis_max" => array(
"queries" => array(
0 => array(
"field" => array(
"name" => 'san'
1 => array(
"field" => array(
"name" => '$an'
"from" => 0,
"size" => 100000,
"sort" => array (

Any help is very much appreciated.


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
To view this discussion on the web visit
For more options, visit

(system) #2