How to sort multiple value search


(Thanigaivelan) #1

Hi,

I have array of values, i want to search show the result in the same array order, how to sort it showing the result in same array format

Example my array value
$myarray=array('84790','19162002','74739','86439','88820','19560020','19634461','19624154','19624091','19577228');

{
"query":{
"filtered":{
"filter":{
"bool":{
"should":[
{
"term":{
"podcast_id":"84790"
}
},
{
"term":{
"podcast_id":"19162002"
}
},
{
"term":{
"podcast_id":"74739"
}
},
{
"term":{
"podcast_id":"86439"
}
},
{
"term":{
"podcast_id":"88820"
}
},
{
"term":{
"podcast_id":"19560020"
}
},
{
"term":{
"podcast_id":"19634461"
}
},
{
"term":{
"podcast_id":"19624154"
}
},
{
"term":{
"podcast_id":"19624091"
}
},
{
"term":{
"podcast_id":"19577228"
}
}
]
}
}
}
}
}

I am using php, curl and post method.

Thanks

Thanigaivelan


(Xavier Facq) #2

Hi, the cost less is to run a multisearch, with one podcast_id per search, and loop results, they'll be in the same order :wink:

Here is a library:
http://elastica.io/api/latest/classes/Elastica.Multi.Search.html


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.