Remove product literal strings in "pht()", part 4
[phabricator.git] / src / docs / user / cluster / cluster_search.diviner
blob25c35aa34a9274859035f4cbb3eb829bce667aae
1 @title Cluster: Search
2 @group cluster
4 Overview
5 ========
7 You can configure Phabricator to connect to one or more fulltext search
8 services.
10 By default, Phabricator will use MySQL for fulltext search. This is suitable
11 for most installs. However, alternate engines are supported.
14 Configuring Search Services
15 ===========================
17 To configure search services, adjust the `cluster.search` configuration
18 option. This option contains a list of one or more fulltext search services,
19 like this:
21 ```lang=json
23   {
24     "type": "...",
25     "hosts": [
26       ...
27     ],
28     "roles": {
29       "read": true,
30       "write": true
31     }
32   }
34 ```
36 When a user makes a change to a document, Phabricator writes the updated
37 document into every configured, writable fulltext service.
39 When a user issues a query, Phabricator tries configured, readable services
40 in order until it is able to execute the query successfully.
42 These options are supported by all service types:
44 | Key | Description |
45 |---|---|
46 | `type` | Constant identifying the service type, like `mysql`.
47 | `roles` | Dictionary of role settings, for enabling reads and writes.
48 | `hosts` | List of hosts for this service.
50 Some service types support additional options.
52 Available Service Types
53 =======================
55 These service types are supported:
57 | Service | Key | Description |
58 |---|---|---|
59 | MySQL | `mysql` | Default MySQL fulltext index.
60 | Elasticsearch | `elasticsearch` | Use an external Elasticsearch service
63 Fulltext Service Roles
64 ======================
66 These roles are supported:
68 | Role | Key | Description
69 |---|---|---|
70 | Read | `read` | Allows the service to be queried when users search.
71 | Write | `write` | Allows documents to be published to the service.
74 Specifying Hosts
75 ================
77 The `hosts` key should contain a list of dictionaries, each specifying the
78 details of a host. A service should normally have one or more hosts.
80 When an option is set at the service level, it serves as a default for all
81 hosts. It may be overridden by changing the value for a particular host.
84 Service Type: MySQL
85 ==============
87 The `mysql` service type does not require any configuration, and does not
88 need to have hosts specified. This service uses the builtin database to
89 index and search documents.
91 A typical `mysql` service configuration looks like this:
93 ```lang=json
95   "type": "mysql"
97 ```
100 Service Type: Elasticsearch
101 ======================
103 The `elasticsearch` service type supports these options:
105 | Key | Description |
106 |---|---|
107 | `protocol` | Either `"http"` (default) or `"https"`.
108 | `port` | Elasticsearch TCP port.
109 | `version` | Elasticsearch version, either `2` or `5` (default).
110 | `path` | Path for the index. Defaults to `/phabricator`. Advanced.
112 A typical `elasticsearch` service configuration looks like this:
114 ```lang=json
116   "type": "elasticsearch",
117   "hosts": [
118     {
119       "protocol": "http",
120       "host": "127.0.0.1",
121       "port": 9200
122     }
123   ]
127 Monitoring Search Services
128 ==========================
130 You can monitor fulltext search in {nav Config > Search Servers}. This
131 interface shows you a quick overview of services and their health.
133 The table on this page shows some basic stats for each configured service,
134 followed by the configuration and current status of each host.
137 Rebuilding Indexes
138 ==================
140 After adding new search services, you will need to rebuild document indexes
141 on them. To do this, first initialize the services:
144 phabricator/ $ ./bin/search init
147 This will perform index setup steps and other one-time configuration.
149 To populate documents in all indexes, run this command:
152 phabricator/ $ ./bin/search index --force --background --type all
155 This initiates an exhaustive rebuild of the document indexes. To get a more
156 detailed list of indexing options available, run:
159 phabricator/ $ ./bin/search help index
163 Advanced Example
164 ================
166 This is a more advanced example which shows a configuration with multiple
167 different services in different roles. In this example:
169   - Phabricator is using an Elasticsearch 2 service as its primary fulltext
170     service.
171   - An Elasticsearch 5 service is online, but only receiving writes.
172   - The MySQL service is serving as a backup if Elasticsearch fails.
174 This particular configuration may not be very useful. It is primarily
175 intended to show how to configure many different options.
178 ```lang=json
180   {
181     "type": "elasticsearch",
182     "version": 2,
183     "hosts": [
184       {
185         "host": "elastic2.mycompany.com",
186         "port": 9200,
187         "protocol": "http"
188       }
189     ]
190   },
191   {
192     "type": "elasticsearch",
193     "version": 5,
194     "hosts": [
195       {
196         "host": "elastic5.mycompany.com",
197         "port": 9789,
198         "protocol": "https"
199         "roles": {
200           "read": false,
201           "write": true
202         }
203       }
204     ]
205   },
206   {
207     "type": "mysql"
208   }