Create an advances Search system for Drupal 8 with Search API. | Drupal 8

Create an advances Search system for Drupal 8 with Search API.

Submitted by editor on Wed, 01/18/2017 - 12:03

How to use advances search server like Solr, Elasticsearch, Database ... With a Drupal 8 site ?

Search API and Database Search server.

1. Uninstall drupal basic Search
2. Install search_api and search_api_db
  NOTE : You can also use another database configures on settings.php
3. Add a Search Server (/admin/config/search/search-api/add-server).
  - Use "Database" as cackend server.
3. Add a Search Index (/admin/config/search/search-api/add-index).
  - Select Enteties (Data source) to index with this index and a search server.
  - Save and Add fields to Index. (Example : Title, Body file for "Contents").
  - Optionaly you can configure "Processors" as Filters, Data traitements ...
4. Enable the newly created "Index" then run indexing or queue indexing.
5. Create a view using your Index, and add field "Search: Fulltext search" as Exposed criteris filter.

Once indexing is done, visit the view's page to use the search system.


Tips : For a quick start, just install the "Database Search Defaults" (), and configure your "Search Server", "Index" and "Search Pages" on.
 - Search API :        /admin/config/search/search-api
 - Search Views :    /admin/structure/views (Defaut : /admin/structure/views/view/search_content )

NOTE : To create a server like Solr, Elasticsearch you need to install search server and the drupal module for those servers.


#Some usefull Drush commands for the search api and facets
#Enable search api
drush pmu search -y
drush en search_api search_api_db -y
#Enable Facets
drush en facets -y
#Index and Re index
drush search-api-index
drush sapi-i


Enable Facets With search API (Example : Db serch)

1. Enable search_api and search_api_db modules
2. Enable facets module for drupal 8
3. Create a Search server and Search Index (at last one search index)
4. Add fields for the index.
    -> Index -> Fields -> "Add field"
5. Create a view to display your search index
6. Create a facet from /admin/config/search/facets -> "add facet" (/admin/config/search/facets/add-facet)
7. Select your facet source (Search view) and Field.
    -> For Tags or entity reference, enable '' and  ''
8. Configure the facet.
NOTE : I got few problems using /search as the search page path.

Now you can see the facets on your search view

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.