protected function buildQuery()
{
$this->setup();
$query = array();
// Index always needs to be provided. _all means a cross index search.
$query['index'] = empty($this->indices) ? '_all' : implode(',', array_values($this->indices));
// Type is not required, will search in the entire index.
if (!empty($this->types)) {
$query['type'] = implode(',', array_values($this->types));
}
// Replace Fragments with their raw body.
$query['body'] = $this->fragmentParser->parse($this->body);
// Add all query string params, the SDK will only add known params to the URL.
foreach ($this->queryStringParams as $paramName => $paramValue) {
$query[$paramName] = $paramValue;
}
return $query;
}