forked from elastic/app-search-firestore-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.yaml
159 lines (142 loc) · 7.11 KB
/
extension.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Learn detailed information about the fields of an extension.yaml file in the docs:
# https://firebase.google.com/docs/extensions/alpha/ref-extension-yaml
name: firestore-elastic-app-search # Identifier for your extension
version: 0.4.1 # Follow semver versioning
specVersion: v1beta # Version of the Firebase Extensions specification
# Friendly display name for your extension (~3-5 words)
displayName: Search with Elastic App Search
# Brief description of the task your extension performs (~1 sentence)
description: >-
Syncs documents from a Firestore collection to Elastic App Search to enable full-text search.
license: Apache-2.0 # https://spdx.org/licenses/
author:
authorName: Elastic
url: https://www.elastic.co/
# Public URL for the source code of your extension
sourceUrl: https://github.com/elastic/app-search-firestore-extension
# Specify whether a paid-tier billing plan is required to use your extension.
# Learn more in the docs: https://firebase.google.com/docs/extensions/alpha/ref-extension-yaml#billing-required-field
billingRequired: true
# Any additional non-Google services used by the extension (typically REST APIs)
externalServices:
- name: Elastic Enterprise Search
pricingUri: https://www.elastic.co/pricing/
# In an `apis` field, list any Google APIs (like Cloud Translation, BigQuery, etc.)
# required for your extension to operate.
# Learn more in the docs: https://firebase.google.com/docs/extensions/alpha/ref-extension-yaml#apis-field
# In a `roles` field, list any IAM access roles required for your extension to operate.
# Learn more in the docs: https://firebase.google.com/docs/extensions/alpha/ref-extension-yaml#roles-field
roles:
- role: datastore.user
reason: Allows the extension to read configuration and build bundles from Firestore.
# In the `resources` field, list each of your extension's functions, including the trigger for each function.
# Learn more in the docs: https://firebase.google.com/docs/extensions/alpha/ref-extension-yaml#resources-field
resources:
- name: shipToElastic
type: firebaseextensions.v1beta.function
description: >-
Function triggered on Create, Update, or Delete of a document in the specified collection which syncs the change
to App Search.
properties:
# LOCATION is a user-configured parameter value specified by the user during installation.
location: ${LOCATION}
# https://cloud.google.com/functions/docs/reference/rest/v1/projects.locations.functions#EventTrigger
eventTrigger:
# Various event types for Firestore are listed here: https://firebase.google.com/docs/extensions/alpha/construct-functions
eventType: providers/cloud.firestore/eventTypes/document.write
# Parameters like PROJECT_ID are autopopulated: https://firebase.google.com/docs/extensions/alpha/parameters#auto-populated-parameters
# Note, the id is a wildcard path parameter, which can be read from the collection
# https://firebase.google.com/docs/firestore/extend-with-functions#wildcards-parameters
resource: projects/${PROJECT_ID}/databases/(default)/documents/${COLLECTION_PATH}/{documentId}
runtime: "nodejs14"
# In the `params` field, set up your extension's user-configured parameters.
# Learn more in the docs: https://firebase.google.com/docs/extensions/alpha/ref-extension-yaml#params-field
# TODO We need more params here
params:
- param: LOCATION
label: Cloud Functions location
description: >-
Choose where you want to deploy the functions created for this extension.
For help selecting a location, refer to the [location selection
guide](https://firebase.google.com/docs/functions/locations).
type: select
options:
- label: Iowa (us-central1)
value: us-central1
- label: South Carolina (us-east1)
value: us-east1
- label: Northern Virginia (us-east4)
value: us-east4
- label: Los Angeles (us-west2)
value: us-west2
- label: Salt Lake City (us-west3)
value: us-west3
- label: Las Vegas (us-west4)
value: us-west4
- label: Warsaw (europe-central2)
value: europe-central2
- label: Belgium (europe-west1)
value: europe-west1
- label: London (europe-west2)
value: europe-west2
- label: Frankfurt (europe-west3)
value: europe-west3
- label: Zurich (europe-west6)
value: europe-west6
- label: Hong Kong (asia-east2)
value: asia-east2
- label: Tokyo (asia-northeast1)
value: asia-northeast1
- label: Osaka (asia-northeast2)
value: asia-northeast2
- label: Seoul (asia-northeast3)
value: asia-northeast3
- label: Mumbai (asia-south1)
value: asia-south1
- label: Jakarta (asia-southeast2)
value: asia-southeast2
- label: Montreal (northamerica-northeast1)
value: northamerica-northeast1
- label: Sao Paulo (southamerica-east1)
value: southamerica-east1
- label: Sydney (australia-southeast1)
value: australia-southeast1
required: true
immutable: true
- param: COLLECTION_PATH
label: Collection path
description: >
The path to the collection that you want to sync to App Search.
example: movies
validationRegex: "^[^/]+(/[^/]+/[^/]+)*$"
validationErrorMessage: Must be a valid Cloud Firestore Collection
required: true
- param: APP_SEARCH_ENGINE_NAME
label: Elastic App Search engine name
description: >
The name of the Elastic App Search "engine" you want to sync to your collection.
example: movies
required: true
- param: APP_SEARCH_API_KEY
label: Elastic App Search private API key
type: secret
description: >-
A "private" API key from your Elastic App Search deployment with access to the engine named above.
API keys can be found in the [App Search "Credentials" page](https://www.elastic.co/guide/en/app-search/current/authentication.html#authentication-api-keys).
example: private-79iadc5dzd3qxgfgd9w9ryc7
required: true
- param: ENTERPRISE_SEARCH_URL
label: Elastic Enterprise Search URL
description: >
The base URL of your Enterprise Search deployment.
This can also be found in the [App Search "Credentials" page](https://www.elastic.co/guide/en/app-search/current/authentication.html#authentication-api-keys).
example: https://example.ent.us-west1.gcp.cloud.es.io/
required: true
# TODO Note which field types are indexable, and how to specify nested fields?
- param: INDEXED_FIELDS
label: Indexed fields
description: >-
A comma separated list of the fields to index from your collection. Only the fields listed will be synced and searchable in App Search. You can specify [fields nested](https://github.com/elastic/app-search-firestore-extension/blob/master/POSTINSTALL.md#nested-fields) in maps with underscores: `field__subField`,
and [new names for fields](https://github.com/elastic/app-search-firestore-extension/blob/master/POSTINSTALL.md#field-name-compatibility-and-renaming) in App Search using a double colon: `PreviousName::newname`.
example: producer,director__name,year
required: true