Hi all,
I have migrated my application's elastic search version from 2.4 to 6.3, in which i saw decrease in performance figures. Size parameter in query request in old version was 1000000000, and by this i was getting 2719674 documents in just 42 seconds, but in new version we need to use scroll concept with size=10000, which gives me same result in 426 seconds which is really not acceptable.
and code for that is as follows.
$client = $this->_createClient();
$aParams = $this->_setContentType($aParams);
$docs = $client->search($aParams);
$iScrollId = $docs['_scroll_id'];
$aHits = $docs['hits']['hits'];
$iScrollSize = $docs['hits']['total'];
$aIDs = array();
if (is_array($aHits)) {
do {
foreach ($aHits as $aHit) {
$iID = explode('_', $aHit['_id'])[0];
if ($this->_aSourceFields != null) {
$aFieldValues = $aHit['_source'];
$aIDs[$iID] = $aFieldValues;
}
else {
array_push($aIDs, $iID);
}
if ($this->bHighlight) {
$aHitHighlights[$iID] = $aHit['highlight'];
}
}
$aScrollResults = array('scroll_id' => $iScrollId, 'scroll' => '1m');
$aEachScroll = $client->scroll($aScrollResults);
$iScrollId = $aEachScroll['_scroll_id'];
$aHits = $aEachScroll['hits']['hits'];
$iScrollSize = count($aHits);
} while ($iScrollSize > 0);
}
$client->clearScroll($this->_deleteScrollRequest($iScrollId));
In the first request, scroll value is "10s"Please tell me if something to optimize the concept.
Thanks and regards,
Kshitij Yelpale