I have integrated Solr with Magento EE. Solr logs whatever I search in Magento fronted search box.

I'd like to know if Magento will also use Solr engine if the search REST API is called?


Product Details - GET- http://<magento_host>/rest/V1/products/:sku

Get Category - GET - http://<magento_host>//V1/categories/:categoryId

General Search API - GET


and the API's mentioned here http://devdocs.magento.com/guides/v2.0/howdoi/webapi/search-criteria.html

  • Can you precise the search REST API for you ? Send me the endpoint. Commented May 18, 2017 at 7:19
  • @FranckGarnier Added endpoints for your reference.
    – blakcaps
    Commented May 18, 2017 at 9:25
  • For me, no these endpoints do not use the search engine. Commented May 18, 2017 at 9:45
  • @FranckGarnier Can you shed some more information how to check if endpoints hitting solr. Is this the default behavior of Magento endpoints even if search engine like solr installed
    – blakcaps
    Commented May 18, 2017 at 9:51

1 Answer 1


The search API is located here :


<route url="/V1/search" method="GET">
    <service class="Magento\Search\Api\SearchInterface" method="search"/>
        <resource ref="anonymous" />


 * {@inheritdoc}
public function search(SearchCriteriaInterface $searchCriteria)

    $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());
    $request = $this->requestBuilder->create();
    $searchResponse = $this->searchEngine->search($request);

    return $this->searchResponseBuilder->build($searchResponse)

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 :


<route url="/V1/products/:sku" method="GET">
    <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="get"/>
        <resource ref="Magento_Catalog::products" />


 * {@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);
        $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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.