Difference between revisions of "Search Elastic"

From SocialStack
Line 8: Line 8:


The module contains a Readme.txt file which gives help for the initial setup of elastic but the creation of the indexes/content are all automated.
The module contains a Readme.txt file which gives help for the initial setup of elastic but the creation of the indexes/content are all automated.
== Installation ==


The basic setup steps are  
The basic setup steps are  
Line 26: Line 28:
Once indexed there is a UI/SiteSearch module which can be used as the basis of the site search
Once indexed there is a UI/SiteSearch module which can be used as the basis of the site search


There are 2 new endpoints relating to search
== Endpoints ==


GET /v1/sitesearch/reset
=== GET /v1/sitesearch/reset ===


This removes any indexes from elastic to allow a clean start
This removes any indexes from elastic to allow a clean start


POST /v1/sitesearch/query
=== POST /v1/sitesearch/query ===


This is the core search endpoint which currently accepts the following values  
This is the core search endpoint which currently accepts the following values  

Revision as of 12:36, 28 February 2023

The elastic search module works alongside the Search Crawler to extract pages from the site into an elastic search instance to enable site wide search

The module registers itself to listen for the search crawler events and creates locale based indexes in the elastic repo for any pages it receives

When indexing the pages, if there is a primary data type then this will also be indexed against the page in primaryObject, this can then be used in query values as explained below

The indexing process is controlled by execution of the search crawler via the site automations

The module contains a Readme.txt file which gives help for the initial setup of elastic but the creation of the indexes/content are all automated.

Installation

The basic setup steps are

  1. Install the following socialstack modules
    • Api/SearchCrawler
    • Api/SearchElastic
    • UI/SiteSearch
  2. Mark any pages not to be indexed
  3. Install Elastic Search (see Readme.txt in the repo for help and guidance)
  4. Configure the sizing/scale in the elasticsearch.yml file (mainly vm memory usage)
  5. Start Elastic Search for the first time and get the master password and certificate fingerprint
  6. Add the url, credentials and fingerprint values to the module configuration via the ss admin panel
  7. Run the automation to index the site, the indexing progress is shown via the console

The module also contains a postman collection which can be used to quick debug/verify the indexed content

Once indexed there is a UI/SiteSearch module which can be used as the basis of the site search

Endpoints

GET /v1/sitesearch/reset

This removes any indexes from elastic to allow a clean start

POST /v1/sitesearch/query

This is the core search endpoint which currently accepts the following values

querystring
The query value entered by the user and/or the Ui component, elastic search uses the lucene query language so as per solr you can build complex queries such as
Africa AND primaryObject.name:Botswana
tags
This expects a list of comma separated tags, if any are supplied the query will only return results which contain all the pased tag values
contentTypes
This expects a list of comma separated content types, if any are supplied the query will only return results which contain all the passed content types, these are normally the primary data object for the page
pageSize
This expects the page size and will default to 10 if not populated
startFrom
This expects the starting row and will default to 0