2016-12-09 1 views
0

Ich habe ein Array von Werten, die ich suchen und seinen Inhalt anzeigen möchte. Was ist die beste Methode, um das Array zu sortieren und das Ergebnis im aktuellen Format des Arrays anzuzeigen?Wie sortiere ich multiple Array Wert Suche in elasticsearch

Beispiel meines Array-Wert

$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" 
        } 
        } 
       ] 
      } 
     } 
     } 
    } 
} 

Ich bin mit PHP, Locke und post-Methode.

Dank

Antwort

0

können Sie verwenden Terms filter insted.

somthing wie folgt aus:

{ 
"query": { 
    "filtered": { 

     "filter": { 
      "terms": { 
       "podcast_id": [ 
       "84790", 
       "19162002", 
       ..... 
       ] 
      } 
     } 
    } 
    } 
}