Closed insekticid closed 1 year ago
Hi, thanks for the detailed report.
Did you use something like the Elasticsearch filter_path
option to have the "_index" field missing? Because it's always there by default.
The thing is, buildModel will always require the index name because it use it to map the source to the appropriate Model class.
@damienalexandre whow! you are life saver, I am using filter_path problem solved! maybe there should be exception when empty array is returned
if (!$result->getIndex()) {
throw new \Exception('Returned indexName is empty. Check your filter_path')
}
Yes that would be a good idea!
Lets keep this issue open to implement this (feel free to open a PR if you have the time by the way!).
ResultSetBuilder::buildModel() should accept array of indexes, when searching between multiple indexes
[ResultSetBuilder::buildModel] Argument #2 ($indexName) must be of type string
Found problem here https://github.com/ruflin/Elastica/blob/6d51cdbff2fb37aceac8b70adf9042ccb9be0aed/src/Result.php#L126
getParam() returns empty array when key not exists and yes, it is missing https://github.com/ruflin/Elastica/blob/6d51cdbff2fb37aceac8b70adf9042ccb9be0aed/src/Result.php#L68![image](https://user-images.githubusercontent.com/177340/194329710-ac219376-7f7d-4599-bec4-4c4522ed8979.png)