File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
app/code/Magento/Elasticsearch
Elasticsearch5/SearchAdapter/Query Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,8 @@ public function initQuery(RequestInterface $request)
91
91
'body ' => [
92
92
'from ' => min (self ::ELASTIC_INT_MAX , $ request ->getFrom ()),
93
93
'size ' => $ request ->getSize (),
94
- 'stored_fields ' => ['_id ' , '_score ' ],
94
+ 'stored_fields ' => '_none_ ' ,
95
+ 'docvalue_fields ' => ['_id ' , '_score ' ],
95
96
'sort ' => $ this ->sortBuilder ->getSort ($ request ),
96
97
'query ' => [],
97
98
],
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ private function getEntityStorage(array $queryResult)
59
59
{
60
60
$ ids = [];
61
61
foreach ($ queryResult ['hits ' ]['hits ' ] as $ document ) {
62
+ if (!array_key_exists ('_id ' , $ document ) && array_key_exists ('fields ' , $ document )) {
63
+ $ document ['_id ' ] = $ document ['fields ' ]['_id ' ][0 ];
64
+ unset($ document ['fields ' ]);
65
+ }
62
66
$ ids [] = $ document ['_id ' ];
63
67
}
64
68
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ public function create($response)
64
64
{
65
65
$ documents = [];
66
66
foreach ($ response ['documents ' ] as $ rawDocument ) {
67
+ if (!array_key_exists ('_id ' , $ rawDocument ) && array_key_exists ('fields ' , $ rawDocument )) {
68
+ $ rawDocument ['_id ' ] = $ rawDocument ['fields ' ]['_id ' ][0 ];
69
+ unset($ rawDocument ['fields ' ]);
70
+ }
67
71
/** @var \Magento\Framework\Api\Search\Document[] $documents */
68
72
$ documents [] = $ this ->documentFactory ->create (
69
73
$ rawDocument
You can’t perform that action at this time.
0 commit comments