]> git.proxmox.com Git - ceph.git/blame - ceph/doc/radosgw/elastic-sync-module.rst
import 15.2.0 Octopus source
[ceph.git] / ceph / doc / radosgw / elastic-sync-module.rst
CommitLineData
11fdf7f2
TL
1=========================
2ElasticSearch Sync Module
3=========================
4
5.. versionadded:: Kraken
6
7This sync module writes the metadata from other zones to `ElasticSearch`_. As of
8luminous this is a json of data fields we currently store in ElasticSearch.
9
10::
11
12 {
13 "_index" : "rgw-gold-ee5863d6",
14 "_type" : "object",
15 "_id" : "34137443-8592-48d9-8ca7-160255d52ade.34137.1:object1:null",
16 "_score" : 1.0,
17 "_source" : {
18 "bucket" : "testbucket123",
19 "name" : "object1",
20 "instance" : "null",
21 "versioned_epoch" : 0,
22 "owner" : {
23 "id" : "user1",
24 "display_name" : "user1"
25 },
26 "permissions" : [
27 "user1"
28 ],
29 "meta" : {
30 "size" : 712354,
31 "mtime" : "2017-05-04T12:54:16.462Z",
32 "etag" : "7ac66c0f148de9519b8bd264312c4d64"
33 }
34 }
35 }
36
37
38
39ElasticSearch tier type configurables
40-------------------------------------
41
42* ``endpoint``
43
44Specifies the Elasticsearch server endpoint to access
45
46* ``num_shards`` (integer)
47
48The number of shards that Elasticsearch will be configured with on
49data sync initialization. Note that this cannot be changed after init.
50Any change here requires rebuild of the Elasticsearch index and reinit
51of the data sync process.
52
53* ``num_replicas`` (integer)
54
55The number of the replicas that Elasticsearch will be configured with
56on data sync initialization.
57
58* ``explicit_custom_meta`` (true | false)
59
60Specifies whether all user custom metadata will be indexed, or whether
61user will need to configure (at the bucket level) what custom
62metadata entries should be indexed. This is false by default
63
64* ``index_buckets_list`` (comma separated list of strings)
65
66If empty, all buckets will be indexed. Otherwise, only buckets
67specified here will be indexed. It is possible to provide bucket
68prefixes (e.g., foo\*), or bucket suffixes (e.g., \*bar).
69
70* ``approved_owners_list`` (comma separated list of strings)
71
72If empty, buckets of all owners will be indexed (subject to other
73restrictions), otherwise, only buckets owned by specified owners will
74be indexed. Suffixes and prefixes can also be provided.
75
76* ``override_index_path`` (string)
77
78if not empty, this string will be used as the elasticsearch index
79path. Otherwise the index path will be determined and generated on
80sync initialization.
81
82
83End user metadata queries
84-------------------------
85
86.. versionadded:: Luminous
87
88Since the ElasticSearch cluster now stores object metadata, it is important that
89the ElasticSearch endpoint is not exposed to the public and only accessible to
90the cluster administrators. For exposing metadata queries to the end user itself
91this poses a problem since we'd want the user to only query their metadata and
92not of any other users, this would require the ElasticSearch cluster to
93authenticate users in a way similar to RGW does which poses a problem.
94
95As of Luminous RGW in the metadata master zone can now service end user
96requests. This allows for not exposing the elasticsearch endpoint in public and
97also solves the authentication and authorization problem since RGW itself can
98authenticate the end user requests. For this purpose RGW introduces a new query
9f95a23c 99in the bucket APIs that can service elasticsearch requests. All these requests
11fdf7f2
TL
100must be sent to the metadata master zone.
101
102Syntax
103~~~~~~
104
105Get an elasticsearch query
106``````````````````````````
107
108::
109
110 GET /{bucket}?query={query-expr}
111
112request params:
113 - max-keys: max number of entries to return
114 - marker: pagination marker
115
116``expression := [(]<arg> <op> <value> [)][<and|or> ...]``
117
118op is one of the following:
119<, <=, ==, >=, >
120
121For example ::
122
123 GET /?query=name==foo
124
125Will return all the indexed keys that user has read permission to, and
126are named 'foo'.
127
128Will return all the indexed keys that user has read permission to, and
129are named 'foo'.
130
131The output will be a list of keys in XML that is similar to the S3
132list buckets response.
133
134Configure custom metadata fields
135````````````````````````````````
136
137Define which custom metadata entries should be indexed (under the
138specified bucket), and what are the types of these keys. If explicit
139custom metadata indexing is configured, this is needed so that rgw
140will index the specified custom metadata values. Otherwise it is
141needed in cases where the indexed metadata keys are of a type other
142than string.
143
144::
145
146 POST /{bucket}?mdsearch
147 x-amz-meta-search: <key [; type]> [, ...]
148
149Multiple metadata fields must be comma separated, a type can be forced for a
150field with a `;`. The currently allowed types are string(default), integer and
151date
152
153eg. if you want to index a custom object metadata x-amz-meta-year as int,
154x-amz-meta-date as type date and x-amz-meta-title as string, you'd do
155
156::
157
158 POST /mybooks?mdsearch
159 x-amz-meta-search: x-amz-meta-year;int, x-amz-meta-release-date;date, x-amz-meta-title;string
160
161
162Delete custom metadata configuration
163````````````````````````````````````
164
165Delete custom metadata bucket configuration.
166
167::
168
169 DELETE /<bucket>?mdsearch
170
171Get custom metadata configuration
172`````````````````````````````````
173
174Retrieve custom metadata bucket configuration.
175
176::
177
178 GET /<bucket>?mdsearch
179
180
181.. _`Elasticsearch`: https://github.com/elastic/elasticsearch