PHRAS-2126_Array-to-String-err-idx_4.1 (#2656)

fix : es error message during indexation is now dumped (not always a string)
fix : es file "size" is now type "long"
This commit is contained in:
jygaulier
2018-07-02 18:41:40 +02:00
committed by GitHub
parent 46cd7c806b
commit 88035173c5
3 changed files with 11 additions and 3 deletions

View File

@@ -157,8 +157,7 @@ class BulkOperation
foreach ($response['items'] as $key => $item) {
foreach($item as $command=>$result) { // command may be "index" or "delete"
if($response['errors'] && $result['status'] >= 400) { // 4xx or 5xx error
$err = array_key_exists('error', $result) ? $result['error'] : ($command . " error " . $result['status']);
throw new Exception(sprintf('%d: %s', $key, $err));
throw new Exception(sprintf('%d: %s', $key, var_export($result, true)));
}
}

View File

@@ -71,7 +71,7 @@ class RecordIndex implements MappingProvider
$mapping->addIntegerField('width')->disableIndexing();
$mapping->addIntegerField('height')->disableIndexing();
$mapping->addIntegerField('size')->disableIndexing();
$mapping->addLongField('size')->disableIndexing();
$mapping->addGeoPointField('location');

View File

@@ -45,6 +45,15 @@ class MappingBuilder
return $this->mapping->addField(new FieldMapping($name, FieldMapping::TYPE_INTEGER));
}
/**
* @param string $name
* @return FieldMapping
*/
public function addLongField($name)
{
return $this->mapping->addField(new FieldMapping($name, FieldMapping::TYPE_LONG));
}
/**
* @param string $name
* @return FieldMapping