1 Requirements
This feature requires an existing installation of Elasticsearch 5 or Elasticsearch 6. Please consult the Elasticsearch documentation for details on installation, configuration and maintenance of Elasticsearch.
The API of the elasticsearch instance must be available from the CMS Server, but should not be available from clients directly.
For indexing file contents, the Ingest Attachment Plugin is also required.
Please use matching versions of Elasticsearch and the Ingest Attachment Plugin. When installing e.g. Elasticsearch v6.2.3, you must install the Ingest Attachment Plugin v6.2.3.
2 Installation and Configuration of Elasticsearch
The Elasticsearch setup documentation includes information on how to setup Elasticsearch and get it running.
Please consult the documentation for the exact version of Elasticsearch you are using.
3 Configuration of the CMS
Indexing and searching must be activated and configured in the CMS:
// activate indexing with elasticsearch $FEATURE["elasticsearch"] = true; // url for connecting to elasticsearch instance $ELASTICSEARCH["url"] = "http://localhost:9200/"; // prefix for indices in elasticsearch $ELASTICSEARCH["index"] = "genticscms"; // number of threads for indexing $ELASTICSEARCH["threads"] = 10;
4 Usage
When the CMS is started (or when the configuration is reloaded), the CMS will check for existence of the required indices and will create missing indices:
Type | Index name |
---|---|
Page | genticscms_page |
Folder | genticscms_folder |
Image | genticscms_image |
File | genticscms_file |
Also the pipeline for ingesting attachments will be created, if necessary.
If at least one index is created, an automatic full reindex run is triggered.
It is also possible to reindex all objects by executing the maintenance tool Refresh search index
.
5 REST API
POST requests to the REST endpoint /CNPortletapp/rest/elastic
will be forwarded to the search API endpoint of Elasticsearch for all four indices:
E.g. the request
POST http://[cmshost]/CNPortletapp/rest/elastic/_search?sid=[SID] { "_source": false, "query": { "query_string": { "query": "Test*" } } }
will be forwarded to
POST http://localhost:9200/genticscms_page,genticscms_file,genticscms_image,genticscms_folder/_search?sid=[SID] { "_source": false, "query": { "query_string": { "query": "Test*" } } }
The response will be extended to contain the CMS objects as attribute _object
of the returned hits
.
6 Mapping
6.1 Page
CMS property | Index attribute | Index type |
---|---|---|
page.id | id | integer |
page.folder.node.id | nodeId | integer |
page.folder.id | folderId | integer |
page.name | name | text |
page.description | description | text |
content | content | text |
page.creationdate.timestamp | created | date (epoch_second) |
page.creator.id | creatorId | integer |
page.editdate.timestamp | edited | date (epoch_second) |
page.editor.id | editorId | integer |
page.publishdate.timestamp | published | date (epoch_second) |
page.publisher.id | publisherId | integer |
page.template.id | templateId | integer |
page.language.code | languageCode | keyword |
6.2 Folder
CMS property | Index attribute | Index type |
---|---|---|
folder.id | id | integer |
folder.node.id | nodeId | integer |
folder.mother | folderId | integer |
folder.name | name | text |
folder.description | description | text |
folder.creationdate.timestamp | created | date (epoch_second) |
folder.creator.id | creatorId | integer |
folder.editdate.timestamp | edited | date (epoch_second) |
folder.editor.id | editorId | integer |
6.3 Image
CMS property | Index attribute | Index type |
---|---|---|
image.id | id | integer |
image.folder.node.id | nodeId | integer |
image.folder.id | folderId | integer |
image.name | name | text |
image.description | description | text |
image.createdate.timestamp | created | date (epoch_second) |
image.creator.id | creatorId | integer |
image.editdate.timestamp | edited | date (epoch_second) |
image.editor.id | editorId | integer |
image.type | mimetype | text |
6.4 File
CMS property | Index attribute | Index type |
---|---|---|
file.id | id | integer |
file.folder.node.id | nodeId | integer |
file.folder.id | folderId | integer |
file.name | name | text |
file.description | description | text |
file.createdate.timestamp | created | date (epoch_second) |
file.creator.id | creatorId | integer |
file.editdate.timestamp | edited | date (epoch_second) |
file.editor.id | editorId | integer |
file.type | mimetype | text |
binarycontent | content | text |
7 New UI
If the feature is activated, the new UI will automatically use the search index for searching objects. Additionally, there will be an “advanced search” panel below the main search bar, which allows further filtering of results by various parameters.
Note: when this feature is enabled, the default search behaviour is slightly different from the regular search. In the regular search, wildcards are automatically added before and after the search term, so “blog” would actually be searched as “*blog*”. This is not the case when Elasticsearch is enabled, so if a wildcard search is desired, the user must explicitly add them.