The search API is located here :
vendor/magento/module-search/etc/webapi.xml
<route url="/V1/search" method="GET">
<service class="Magento\Search\Api\SearchInterface" method="search"/>
<resources>
<resource ref="anonymous" />
</resources>
</route>
vendor/magento/framework/Search/Search.php
/**
* {@inheritdoc}
*/
public function search(SearchCriteriaInterface $searchCriteria)
{
$this->requestBuilder->setRequestName($searchCriteria->getRequestName());
$scope = $this->scopeResolver->getScope()->getId();
$this->requestBuilder->bindDimension('scope', $scope);
foreach ($searchCriteria->getFilterGroups() as $filterGroup) {
foreach ($filterGroup->getFilters() as $filter) {
$this->addFieldToFilter($filter->getField(), $filter->getValue());
}
}
$this->requestBuilder->setFrom($searchCriteria->getCurrentPage() * $searchCriteria->getPageSize());
$this->requestBuilder->setSize($searchCriteria->getPageSize());
$request = $this->requestBuilder->create();
$searchResponse = $this->searchEngine->search($request);
return $this->searchResponseBuilder->build($searchResponse)
->setSearchCriteria($searchCriteria);
}
So you can use existing search defined in the search_request.xml
files or build your own search requests.
Example for catalogsearch used on the Magento FO :
vendor/magento/module-catalog-search/etc/search_request.xml
Then you can extend the SearchEngine module to add new search features such as autocomplete.
Moreover you can see that other API calls such as /V1/products/:sku
do not use Search Engine but repository with Mysql request behind :
vendor/magento/module-catalog/etc/webapi.xml
<route url="/V1/products/:sku" method="GET">
<service class="Magento\Catalog\Api\ProductRepositoryInterface" method="get"/>
<resources>
<resource ref="Magento_Catalog::products" />
</resources>
</route>
vendor/magento/module-catalog/Model/ProductRepository.php
/**
* {@inheritdoc}
*/
public function get($sku, $editMode = false, $storeId = null, $forceReload = false)
{
$cacheKey = $this->getCacheKey([$editMode, $storeId]);
if (!isset($this->instances[$sku][$cacheKey]) || $forceReload) {
$product = $this->productFactory->create();
$productId = $this->resourceModel->getIdBySku($sku);
if (!$productId) {
throw new NoSuchEntityException(__('Requested product doesn\'t exist'));
}
if ($editMode) {
$product->setData('_edit_mode', true);
}
if ($storeId !== null) {
$product->setData('store_id', $storeId);
}
$product->load($productId);
$this->instances[$sku][$cacheKey] = $product;
$this->instancesById[$product->getId()][$cacheKey] = $product;
}
return $this->instances[$sku][$cacheKey];
}
And by the way I recommended ElasticSearch with Magento EE.