File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Response/Result/Aggregation Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ public function toArray(): array
5757 if ($ field instanceof \Spameri \ElasticQuery \Mapping \Settings \Mapping \SubFields) {
5858 $ fields [$ field ->key ()] = $ field ->toArray ();
5959
60+ } elseif ($ field instanceof \Spameri \ElasticQuery \Mapping \Settings \Mapping \FieldObject) {
61+ $ fields [$ field ->key ()] = $ field ->toArray ();
62+
6063 } else {
6164 $ fields [$ field ->key ()] = $ field ->toArray ()[$ field ->key ()];
6265 }
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class FieldObject
1919
2020 public function __construct (
2121 string $ name ,
22- \Spameri \ElasticQuery \Mapping \Settings $ fields
22+ \Spameri \ElasticQuery \Mapping \Settings \ Mapping \ FieldCollection $ fields
2323 )
2424 {
2525 $ this ->name = $ name ;
@@ -38,13 +38,12 @@ public function toArray(): array
3838 $ fields = [];
3939 /** @var \Spameri\ElasticQuery\Mapping\Settings\Mapping\FieldInterface $field */
4040 foreach ($ this ->fields as $ field ) {
41- $ fields [$ field ->key ()] = $ field ->toArray ();
41+ $ fields [$ field ->key ()] = $ field ->toArray ()[ $ field -> key ()] ;
4242 }
4343
4444 return [
45- $ this ->name => [
46- 'properties ' => $ fields ,
47- ],
45+ 'properties ' => $ fields ,
46+ 'type ' => 'object ' ,
4847 ];
4948 }
5049
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public function __construct(
4848
4949 public function key () : string
5050 {
51- return $ this ->key ;
51+ return ( string ) $ this ->key ;
5252 }
5353
5454
You can’t perform that action at this time.
0 commit comments