Introduction
A development team’s information is split across tools: code and READMEs live in Git, design documents in Confluence, issues in Jira, and discussions in Slack. Searching all four tools one after another every time you need to find “where was that specification decided?” is tedious. With the Fess data store plugins, you can search the information in all four tools from a single search page.
If the configuration is wrong, however, you end up with situations like these:
All Git files are registered with an empty URL, so the original file cannot be opened from the search results
All Slack messages are shown with an empty title
Messages from private channels appear in the search results of users who are not logged in
Git files disappear from the index after a few days
For each tool, this article shows a minimal configuration that works as written, and explains how each setting avoids the pitfalls above. The steps common to all data stores, such as installing plugins, writing the handler name, parameters and script, and creating jobs, are covered in Data Store Crawling Basics. Read that article first before continuing. The settings in this article match Fess 15.9 and version 15.9.0 of each plugin.
What We Will Build
| Tool | Plugin | Handler name | What to prepare on the tool side |
|---|---|---|---|
| Git | fess-ds-git | GitDataStore | An access token with read permission (must be able to clone over HTTPS) |
| Confluence / Jira | fess-ds-atlassian | ConfluenceDataStore / JiraDataStore | An API token for the crawl account |
| Slack | fess-ds-slack | SlackDataStore | The Bot User OAuth Token (xoxb-) of a Slack app |
If you run Fess on Docker, you can install all of the plugins at startup by listing the plugin names and versions, separated by spaces, in the FESS_PLUGINS environment variable.
If you install them from the admin console or with fess-setup, restart Fess after installation.
Decide First: Who Can See the Search Results
When you create a new data store configuration, the “Permissions” field is prefilled with {role}guest. If you leave it as is, the imported information can be found by users who are not logged in.
The Git, Confluence and Jira plugins do not carry the access rights of the original tool over into Fess. Everything the crawl account can read is imported, and it is visible to anyone who has a role or group written in the “Permissions” field. You therefore decide the scope by combining the following two points:
Replace
{role}guestin the “Permissions” field with the people who should see the content (e.g.{group}developers)Narrow what is imported to what those people may see, using the permissions of the crawl account, and
jira.jqlandinclude_patterndescribed later
Only the Slack plugin can import the members of private channels as permissions (described later). For how groups and roles work, see Controlling Search Results with Roles and Groups.
Git Repositories
Preparation
fess-ds-git clones over HTTPS. SSH URIs (the git@... form) are not supported. For private repositories, create an access token for reading. For a GitHub classic token, that is the repo scope; for GitLab, the read_repository scope.
Parameters and Script
In [Crawler] > [Data Store] > [Create New], select GitDataStore as the “Handler Name”.
Each line means the following:
base_url: the script’surlisbase_urlconcatenated as is with the path within the repository. If you omit it,urlbecomes an empty string, and all files get the same document ID and overwrite each other. End it with/, and make the branch name match the branch being crawled (by default the remote’s default branch; to change it, usecommit_id).username/password: used for authentication only when both are specified. Do not embed the token inuri; write it inpassword(passwordis encrypted when saved, buturiis not).include_pattern: a regular expression that must match the entire path within the repository (e.g.docs/setup.md). It is not a URL.title=path: withname, which is only the file name, files with the same name such asREADME.mdcannot be told apart in the search results, so the path is used instead.
Differential Crawling and Expiration
When a crawl succeeds, fess-ds-git writes its commit ID back to prev_commit_id in the “Parameters” field. From the second crawl on, it registers only the files in the diff from the previous commit, and deletes the documents of files that were deleted or renamed (reflecting deletions requires base_url).
This differential crawling does not work well with Fess’s document expiration, which is why the example above specifies time_to_live. Data store documents are given an expiration date when they are registered. By default it is determined by “Delete old documents” in [System] > [General] (3 days by default), and documents past their expiration are deleted by the “Doc Purger” job, which runs every minute. In differential crawling, unchanged files are not registered again, so their expiration is not extended and they disappear a few days after the first crawl. time_to_live is a parameter that specifies the expiration of this configuration’s documents in minutes; 5256000 is about 10 years.
For the same reason, changes to the script, base_url, include_pattern or the “Permissions” field are not reflected in unchanged files. To register all files again, follow these steps:
In [System Info] > [Search], search for
label:codeand delete the old documents with [Delete All by this Query]Clear the value of
prev_commit_id=in the “Parameters” field and saveRun the job
If you changed the “Permissions” field or base_url, the document IDs change, so old documents remain if you skip step 1. When you delete this data store configuration, also delete its documents first with step 1.
Confluence
On Atlassian Cloud, create an API token with the crawl account and use it as the Basic authentication password. What is imported are the pages and blog posts in the spaces that this account can view. Select ConfluenceDataStore as the “Handler Name”.
homeworks with or without/wiki. On Cloud,/wikiis added for Confluence.If
deploymentis omitted, it is treated ascloudwhen the host name ends with.atlassian.net, and asdatacenterotherwise.Adding
content.commentsmakes the page’s comments searchable as part of the body. The comments are concatenated, separated by blank lines.include_patternis matched against the entire document URL. On Cloud, page URLs have the formhttps://<site>/wiki/spaces/<space-key>/pages/<page-id>, so you can narrow by space key. Data Center URLs (/pages/viewpage.action?pageId=...) do not contain the space key, so this method cannot be used there.
On Data Center, set deployment=datacenter, and to use a personal access token, specify auth_type=pat and pat.token.
Jira
Authentication is the same as for Confluence. Select JiraDataStore as the “Handler Name” and narrow the issues to import with JQL.
The JQL parameter is named jira.jql. The old name issue.jql still works, but the log shows the warning Parameter "issue.jql" is deprecated. The old name is scheduled to be removed in 16.0. If jira.jql is omitted, created is not empty is used, which means every issue the account can view.
Adding issue.comments puts the issue’s comments into the body as well, separated by blank lines, so they become searchable. Comments are fetched through the API for each issue, which increases the number of calls (see the rate limits described later).
Slack
Preparing the Slack App
Create an app at https://api.slack.com/apps and add the following scopes to Bot Token Scopes under [OAuth & Permissions]; then install the app to your workspace.
| Scope | When it is needed |
|---|---|
channels:read, channels:history, users:read, team:read | Always |
groups:read, groups:history | To import private channels (include_private=true) |
users:read.email | To use private channel members as permissions (permission_sync=true) |
files:read | To import files as well (file_crawl=true) |
Without team:read, the plugin calls chat.getPermalink for every message, which greatly increases the number of API calls. After installation, add the app to each channel you want to import. Channels the app has not joined are skipped with a warning.
Create two separate data store configurations: one for public channels and one for private channels. The reason is explained in the “Private Channels” section.
Public Channels
Select SlackDataStore as the “Handler Name”, and set the “Permissions” field to the people who should see the public channels.
message.title is always an empty string for messages, so if you write title=message.title, every result has no title. As in the example above, build the title from the poster and the channel name. Thread replies are also registered as individual documents. System messages such as channel_join are excluded by default (ignore_system_events=true).
Private Channels
With permission_sync=true, the plugin creates a user role for each member from the email addresses of the private channel’s members and puts them in message.roles. However, the values of default_permissions and the “Permissions” field are also added to this value. Public channels have no roles of their own, so if both of these are empty, documents from public channels are visible to no one. Conversely, if you put the audience for public channels in either of them, that audience can also see the documents from private channels. Because a single configuration cannot handle both correctly, private channels get a separate configuration.
In the second data store configuration, delete {role}guest from the “Permissions” field to leave it empty, and list the names of the private channels to import in channels.
If you do not write
role=message.roles, the computed roles are not used. In that case, the warningno script value references message.rolesis shown when the crawl starts.If you mix public channels into
channels, their documents have empty roles and are visible to no one.With this configuration, the warning
default_permissions is not set and this crawl's DataConfig permission field is emptyis shown when the crawl starts. As long as no public channels are included, this is not a problem.Channels whose members could not be retrieved, or for which not a single email address could be resolved (for example, because
users:read.emailwas forgotten), are not imported in that crawl. They are recorded in [System Info] > [Failure URL] with the channel ID and channel name.
At search time, the user name of the user logged in to Fess is matched against these email addresses. The Fess user name must therefore match the Slack email address. Slack handles email addresses in lowercase, so Fess user names should be lowercase too. Users who do not match simply do not see the private channel documents; they never see anyone else’s documents. For which value becomes the user name when users log in with SSO, see Protecting Search with SSO and Access Control.
If you had already imported private channels without permission_sync, those documents remain without permissions until they expire. Delete those documents in [System Info] > [Search] before crawling with this configuration.
Labels, Boost and Schedules
Labels are assigned by the label="..." line in each script above. To show them as filters on the search page, create labels with the same values (code, docs, tickets, slack) in [Crawler] > [Label]. Note that if a label has “Included Paths” that match the document URL, the script’s label is lost (Data Store Crawling Basics).
Rules in [Crawler] > [document Boost] are not applied to data store documents. To rank Confluence design documents above Slack messages, raise the “Boost” (initial value 1.0) of the Confluence data store configuration. The value is multiplied into the search score, so change it gradually and compare the search results.
To run each tool at a different frequency, use [Create New Job] on the details page of each data store configuration (Data Store Crawling Basics).
API Rate Limits
The Slack and Atlassian plugins automatically retry 429 and 5xx responses, and if there is a Retry-After header, they wait that many seconds (up to 60 seconds for Slack).
| Plugin | Adjustable parameters |
|---|---|
| Slack | read_interval (wait time per message, in milliseconds, default 0), max_retry_count (default 3), retry_interval (wait time before the first retry, in milliseconds, default 3000; doubled on each retry, up to 60 seconds) |
| Atlassian | read_interval (minimum interval between API calls, in milliseconds, default 0; shared between threads). The number of retries and their interval are fixed |
When Slack exhausts its retries, the crawl is aborted. The status in the job log stays “OK”, so check it with the steps in the next section.
Verifying the Results
How to read job results and logs is explained in Data Store Crawling Basics. A data store crawl can fail while the job is still shown as “OK”, so judge by document counts and logs. For the setup in this article, also check the following:
In [System Info] > [Search], search for each of
label:code,label:docs,label:ticketsandlabel:slack, and confirm that the count is not 0Open the URL of a Git document and confirm that the repository file is displayed. If
fess-crawler.logcontains the warningbase_url is blank, reviewbase_urlOpen the details page of the Git configuration and confirm that
prev_commit_idhas been written back to the parametersWhile logged out, search for a word that appears only in a private channel, and confirm that nothing is found
Log in as a member of that channel and confirm that the same word is found
If it is not found in step 5, check whether the Fess user name matches the Slack email address, and whether fess-crawler.log contains the warning private channel(s) skipped. If an entire configuration fails, for example because of an authentication error, it is recorded per configuration in [System Info] > [Failure URL].
Summary
For Git, always specify
base_url, and addtime_to_liveso that documents do not expire under differential crawling.For Confluence and Jira, import comments too with
content.comments/issue.comments, and write JQL injira.jql.For Slack, build the title from
message.userandmessage.channel.Git, Confluence and Jira do not carry over the original permissions, so decide who can see the content with the “Permissions” field and the import scope.
Put Slack private channels in a separate configuration, and import them with
permission_sync=true,role=message.rolesand an empty “Permissions” field.Adjust the priority of each information source with the “Boost” of its data store configuration.