Hi,
I hope somebody can help me, though my question mentions PHP the sort
problem happens when I use the console to fetch data.
I am having a MongoDb database with data and use elastic search and PHP to
search and display the search results.
The document contains multilingual, see the example below:
"data": {
"ti": {
"en": "Poland-Gdansk: Network Equipment",
"nl": "Polen-Gdansk: Netwerk Apparatuur",
"si": "Poljska-Gdansk: Oprema za omrežje"
}
}
Note: the document has obvious more data but I don't believe it is
relevent at the moment to make my question understandable. If you want me
to post a complete document, please let me know and I will be happy to do
so.
I am getting the search result fine but when I do a sort om ti field for an
ascending or descending sort the returned dataset is missed up.
I am using the official elastic search PHP library available on
https://github.com/elasticsearch/elasticsearch-php.
The sort order I set as followed:
$sitelanguage = "en";
$order = "asc";
$sortOrder = array(
"title." . $sitelanguage => array(
"order" => $order
)
);
These array then is put to the code that build the search query:
$searchParams = array(
'body' => array(
'query' => array(
'bool' => array(
'must' => array(
array(
'query_string' => array(
'default_field' => '_all',
'query' => 'Gdansk'
)
),
)
)
),
'sort' => $sortOrder
)
);
It looks to me that with ascending sort order the sort that is executed is
done with the "en" key while descending is done with the "si" key instead
of the value "Poland-Gdansk: Network Equipment".
How could I solve is so that sorting is done correctly, so when
$sitelanguage is set to "en" it sorts only on the value in this array and
obvious if any other value is set in the variable the sort is done using
that value.
--
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/4ab37ef4-8f6f-455e-bb6f-947873dad0d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.