Replies: 1 comment 2 replies
-
Hey @maxxer You always could write and use your own For example: class GeoShapePreIndexed extends AbstractGeoShape
{
private $_indexedId;
private $_indexedIndex;
private $_indexedPath;
private $_routing;
public function __construct(
string $path,
string $indexedId,
string $indexedIndex,
string $indexedPath,
?string $routing = null,
) {
$this->_path = $path;
$this->_indexedId = $indexedId;
$this->_indexedIndex = $indexedIndex;
$this->_indexedPath = $indexedPath;
$this->_routing = $routing;
}
/**
* {@inheritdoc}
*/
public function toArray(): array
{
return [
'geo_shape' => [
$this->_path => [
'indexed_shape' => array_filter([
'id' => $this->_indexedId,
'index' => $this->_indexedIndex,
'path' => $this->_indexedPath,
'routing' => $this->_routing,
]),
'relation' => $this->_relation,
],
],
];
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just filed issue #2216, because I believe it misses the ability to declare the optional parameter
routing
. To my understanding, it's not possible to add it with the currently available methods, because thetoArray()
produces a static structure that doesn't include that attribute.Is there any other way than altering the class, that I didn't spot? thanks
Beta Was this translation helpful? Give feedback.
All reactions