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)
9191 'body ' => [
9292 'from ' => min (self ::ELASTIC_INT_MAX , $ request ->getFrom ()),
9393 'size ' => $ request ->getSize (),
94- 'stored_fields ' => ['_id ' , '_score ' ],
94+ 'stored_fields ' => '_none_ ' ,
95+ 'docvalue_fields ' => ['_id ' , '_score ' ],
9596 'sort ' => $ this ->sortBuilder ->getSort ($ request ),
9697 'query ' => [],
9798 ],
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ private function getEntityStorage(array $queryResult)
5959 {
6060 $ ids = [];
6161 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+ }
6266 $ ids [] = $ document ['_id ' ];
6367 }
6468
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ public function create($response)
6464 {
6565 $ documents = [];
6666 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+ }
6771 /** @var \Magento\Framework\Api\Search\Document[] $documents */
6872 $ documents [] = $ this ->documentFactory ->create (
6973 $ rawDocument
You can’t perform that action at this time.
0 commit comments