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
on.
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 (
"_score"
)
)
);

Any help is very much appreciated.

Thanks,
Vallabh

--
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/80dc86a5-6a40-4b0c-b155-34ac80dabc3b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2