最近ESを使用しようとしました。だから私は雲9の環境でそれを設定しました。ここで ...私はその後、サイレックスで弾性SDK(V.2.0)を設定してみましたが、私は同じ出力を得ることができない私は、カール要求ファイルを使用してデータを挿入して、私はElasticSearch PHP SDK検索でmatch_allクエリでnullが返される
http://mydomain/ingredients/aliments/_search?size=350&pretty=true
でそれらを見ることができます私のコードは次のとおりです。
$client = $app['elasticsearch'];
$params = array(
'size' => 350,
'index' => 'ingredients',
'type'=>'aliment',
'body' => array(
'query'=>array(
'match_all' => new \stdClass()
)
)
);
$ingredients = $client->search($params);
出力がNULL
ですが、私は次の操作を実行したときに:予想通り
$params = array(
'index' => 'ingredients',
'type' => 'aliment'
);
$count = $client->count($params);
を出力は次のとおりです。{"count":240,"_shards":{"total":5,"successful":5,"failed":0}}
私はすでに何が起こっているのか把握しようと数時間を費やしてきました。私は 'query' argsをjson文字列に置き換えようとしましたが、新しいstdClassの代わりに空の配列を試しましたが、
編集:私はもう一度マニュアルを読み、公式の例を試してみました:
$client = $app['elasticsearch'];
$params = [
"search_type" => "scan", // use search_type=scan
"scroll" => "30s", // how long between scroll requests. should be small!
"size" => 50, // how many results *per shard* you want back
"index" => "ingredients",
"body" => [
"query" => [
"match_all" => []
]
]
];
$output = $client->search($params);
$scroll_id = $output['_scroll_id']; /*<<<This works****/
while (\true) {
// Execute a Scroll request
$response = $client->scroll([
"scroll_id" => $scroll_id, //...using our previously obtained _scroll_id
"scroll" => "30s" // and the same timeout window
]
);
var_dump($response); /*<<<THIS IS NULL****/
...
}
そして、残念ながら同じヌル結果を得ました...
私が間違って何をしているのですか?
読んでいただきありがとうございます。