Advanced Search - Magento 2

Firefox user notice:

Please use another web browser to view this document.

Sorry for the inconvenience.


Magento 2 Advanced Search makes on-site search quick and efficient with the Elasticsearch engine and advanced functionality. The module ensures the opportunity to find relevant results across all the products, static pages, and even blog posts and FAQ's if integrated with the corresponding Aheadworks extensions. The effectiveness of the workflow is additionally supported by autosuggestions, recent searches, improved synonyms, spelling corrections, and other functions.

Compatibility: Magento Open Source 2.2.X, Magento Commerce 2.2.X

Product Page

Thank you for choosing Aheadworks!

Installing Advanced Search

Command Line InstallationComposer Installation

1. Backup your web directory and store database

2. Download the Advanced Search installation package

 3. Upload contents of the Advanced Search installation package to your store root directory

 4. In SSH console of your server navigate to your store root folder:

cd path_to_the_store_root_folder

run the following command: :

php -f bin/magento module:enable Aheadworks_AdvancedSearch


php -f bin/magento setup:upgrade


php -f bin/magento setup:static-content:deploy

5. Flush store cache; log out from the backend and log in again

Make sure the installation is done from the FTP Administrator account. Otherwise, set 775 permissions to the store root directory after the extension is deployed.

If you are installing an extension from Aheadworks for the first time, you need to add our composer repository to your Magento store:

1. Login to your ssh console and navigate to your store folder:

cd path_to_the_store_root_folder

Run the following command:

composer config repositories.aheadworks composer

On successful execution of the command you will be able to use the composer to install the extensions.

To install the extension:

2. Login to your ssh console and navigate to your store folder:

cd path_to_the_store_root_folder

 3. Run the following command to install the latest version of the extension:

composer require aheadworks/module-advanced-search

if you need to install a specific version, run this command:

composer require aheadworks/module-advanced-search:<version>

Specify the version of the extension in <version>

When prompted, enter Public Key (Username) and Private Key (Password):

Both Public Key (Username) and Private Key (Password) can be found in My Projects and Licenses in your personal account on our site:

4. Enable the extension:

php -f bin/magento module:enable Aheadworks_AdvancedSearch

Next, register the extension:

bin/magento setup:upgrade

Recompile your Magento store if you are in the Production mode:

bin/magento setup:di:compile

To verify that the extension is enabled, run this command:

bin/magento module:status

Clean store cache, by running the following command:

bin/magento cache:clean

Log out and Log in the backend again.

To upgrade the extension:

5. To update or upgrade an extension:

Download the updated extension file. Take note of the module-name and version. Export the contents to your Magento root.

If a composer package exists for the extension, run one of the following.

Update per module name:
composer update aheadworks/module-advanced-search
Updater per version:
composer require aheadworks/module-advanced-search:<version>

Run the following commands to upgrade, deploy, and clean the cache.

php bin/magento setup:upgrade --keep-generated
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

Installing the Elasticsearch package

Next, you'll need to install the Elasticsearch package into Magento root directory with the following command:

composer require elasticsearch/elasticsearch:~6.0

Getting Around

Right after the installation of the Advanced Search extension, you need to configure Elasticsearch, define the general extension settings, and add new indexes, if necessary. Please refer to corresponding sections below.

Elasticsearch is a third-party solution, which has to be installed individually on your web server and connected with the Magento store. The installation requires some OS-administrative skills, so you may need to contact your server administrator or hosting provider on the matter.

As soon as all the above configuration steps are passed you can enjoy the result on the frontend. Advanced Search provides the next benefits and functionality values:

  • Search by products, CMS pages, and even blog and FAQ content (integration required);
  • Automatic search result suggestions;
  • Search query spelling corrections;
  • Improved web store productivity.

Search Pages and Content

By default, Advanced Search is able to search results across products and CMS pages. Moreover, it looks through the entire content related to products regardless whether it is displayed on product pages or not.

Still, only the product pages with 'Search' and 'Catalog and Search' visibility options are going to be displayed as search results by the extension. This behavior is equally applicable to Magento Open Source and Magento Commerce editions. In addition to that, for the Magento Commerce online stores, the extension also complies with user access catalog restrictions.

In order to expand the searchable area, you can install our Blog and FAQ extensions and provide customers with blog posts and FAQ sections content search.

Once a shopper enters a search query and hits 'Enter' or taps the 'all search results' button on the popup, the search results page appears. It may contain up to four tabs with products, CMS pages, Blog posts, and FAQ content results.

All the fetched product results can be sorted and filtered by the native layered navigation functionality.

If you have installed our Layered Navigation 1.9.X +, you can also use it for the same purpose.

Automatic Suggestions

With Advanced Search, customers start receiving search results as soon as they type the first characters of their search queries. This serves both as a great usability improvement and as a suggested direction to particular products and pages.

All the suggested results are divided into several blocks by their importance for customers. First come products, next product categories, and finally CMS, Blog, and FAQ page results.

The whole query or a part of it is highlighted, so customers can easily distinguish where and how it appears on the fetched pages. For example, the search popup may contain product and category names, or some text extracts containing the search query.

Once a customer enters the search box for the second time, a block with recent searches pops up immediately. This way customers do not need to recall their previous searches. The 'recent search' results are stored during one visitor's session. If necessary, customers can clear the history of searches in one click. Magento admins can also disable this functionality from the backend.

The query is considered to be valid for 'recent searches' if:

  • Using this query a customer clicked on the 'All search results' button and was redirected to the search results page;
  • A customer received an autosuggestion and clicked on the provided option. This option will be added to recent searches;
  • A customer selected a suggested product search option, the whole word of the product name will be considered as a recent search term.

Spelling Corrections

If customers make some typos entering a search query, the Advanced Search extension will still provide the results for both incorrect and/or corrected search queries.

Increased Productivity

As an additional benefit, the Advanced Search extension allows you to run both search and catalog on Elasticsearch.

Product Visibility and User Permissions Consideration

Advanced Search takes into account product visibility options. So, products are searchable only if they have either Search or Catalog, Search visibility values enabled.

For Magento Commerce stores, it additionally complies with the catalog permissions declared for particular customer groups.

Backend Configuration

Elasticsearch Configuration

The first step you need to take right after the Advanced Search installation is to enable and configure Elastic search. The configuration section is located at: Stores > Configuration > Catalog > Catalog > Catalog Search. Choose the Advanced Search option in the Search Engine box. Next, you need to select the Elasticsearch option in the Advanced Search engine box.

Now, you need to configure the Elasticsearch engine using the next setting options:

  • Advanced search engine - Elasticsearch;
  • Elasticsearch Server Hostname - specify the full hostname or IP address of the Elasticsearch server;
  • Elasticsearch Server Port - Elasticsearch server proxy port, usually 443 for a secure proxy;
  • Elasticsearch Index Prefix - prefixes are used in the cases you have single Elasticsearch for more than one Magento instance (for example, staging and development environments) in order to distinguish them from each other;
  • Enable Elasticsearch HTTP Auth - enable this option if you use authentification for your Elasticsearch server. If enabled, also specify your username and password;
  • Elasticsearch Server Timeout - determines the time in seconds a server waits for the connection with the Elasticsearch.

As soon as all the above options are provided you can test the connection using the dedicated button.

Extension Configuration

The second step is the extension configuration. The Configuration page has two sections:
General and Search Autocomplete Suggestions Configuration. The first one allows you to enable/disable spelling corrections with the Enable Did You Mean Search option.

The functionality is able to slow down your store performance.

The second section contains three configuration options:

  • Enable Autocomplete Suggestions - allows you to enable the autosuggestions functionality;
  • Show search query highlight - makes it possible to highlight search queries in search results in bold;
  • Maximum number of recent searches - determines the number of recent search suggestions to be displayed on frontend.

Index Management

Search indexes determine the areas of search used by the extension. As soon as Magento has its own on-site search functionality, all the indexes existing before the extension installation are used by Advanced Search automatically, so you have no need to create them once again.


Right after the extension installation, all searchable attributes and their weights are imported into the extension's product index. After that, any connection with the Magento search settings of those attributes is not maintained. In practice that means that:

  • It is recommended that both attribute weights and "searchable" flags are managed on the Product Index page.
  • Any changes of those parameters on the native attribute settings page will not have any effect unless they will be manually duplicated on the Product Index page.
  • Any changes of search parameters on the extension's Product Index page are not reflected in native attribute settings.

Index Management Page

In order to enter the Index Management page please follow the next path: Marketing > Advanced Search by Aheadworks > Index Management. The Index Management grid displayed on the page contains several columns: ID, Type, Store View, Status, Updated, and Action. This way, you can see all the indexes in one place, know their type, eligible store views, index statuses, dates and time of their updates. You can also edit, delete or invalidate the indexes using the Select box in the Action column. Also, you are able to delete or invalidate indexes massively using the provided mass-action functionality.

Using the Add Index button you can create any number of new indexes you need.

Create New Index

By default, using the Add Index box you can create two types of indexes: Products and CMS pages. But, if you have installed our latest Blog and FAQ extensions, the box will contain four options, including Blog And FAQ.

Each New Index or Edit Index page has two sections: General and Searchable Attributes. Using the options of the first section you can enable/disable the extension and assign it to a particular Magento store or store view. The second section allows you to add any number of index attributes, edit, and delete the existing ones.

  • You won't be able to create an index until at least one index attribute is provided.
  • Also, you can't create two or more indexes of the same type.

The Searchable Attributes has two manageable columns: Attribute Code and Weight. The first one defines the attribute while the second defines the importance of the attribute to be used in search results. The attributes with higher weights are more important.

Product Index

The Product index allows you to utilize all and any product attributes as product index attributes. As soon as you add a new attribute and enter the Attribute Code box, the extension shows the whole list of available product attributes. You can also narrow down the selection and use only searchable attributes with the Attributes Set as Searchable in Magento checkbox.

CMS Index

The CMS index type allows the extension to search through enabled CMS pages. The list of available attributes includes:

  • Page Title;
  • Content Heading;
  • Content;
  • Meta Title;
  • Meta Keywords;
  • Meta Description.

The Additional Settings section allows you to exclude particular pages from the created index.

Blog Index

The Blog index is used to search the posts created by the Blog extension for Magento 2 by Aheadworks. It processes only published posts. The list of available attributes includes:

  • Post Title;
  • Short Content;
  • Content;
  • Mets Description;
  • Tags.

FAQ Index

The FAQ index type allows the extension to search through the articles created by the FAQ extension for Magento 2 by Aheadworks. The list of available index attributes includes:

  • Article Title;
  • Meta Title;
  • Meta Description;
  • Content;
  • Category.

Reindex Mechanisms

As soon as new products are created, new CMS pages are added, new blog posts and FAQ articles are written, search indexes should be regularly updated. Advanced Search allows to renew indexes:

  • When you save a new index,
  • Manually on the native Magento Index Management page;
  • Automatically by cron.

Synonym Management

Synonyms significantly improve the quality of search and able to offer more valuable search results. The Advanced Search extension works with the existing synonym groups, so you don't have to create them once again after the installation of the extension.

The module also makes it possible to add new search terms to existing synonym groups or create new ones right from the Search Terms page in a few clicks.

Failure-proof Support

In the case, you use Elasticsearch located on a remote server and anyhow experience some connection issues, the Advanced Search extension provides you with the failure-proof support. If this situation happens, the extension switches the on-site search to the native MySQL search engine and allows your customers to continue using the search functionality.

Uninstalling Advanced Search

Manual Removal

1. Disable the module by executing the following commands:

php bin/magento module:disable Aheadworks_AdvancedSearch
php bin/magento setup:upgrade

2. Remove the extension files from the following folder:


Automatic Removal (via Composer)

1. Disable the module by executing the following commands:

php bin/magento module:uninstall Aheadworks_AdvancedSearch

Product Page

Need Customization?

You can always find the latest version of the software, full documentation, demos, screenshots, and reviews on
License agreement:
Contact Us:
Copyright © 2021 Aheadworks Co.