#app/config/config.yml
ongr_api:
versions:
v3:
endpoints:
product: #this key represents endpoint name which will be used in URL
repository: es.manager.default.product #required
methods: ["GET", "POST"] #default: GET, POST, PUT, DELETE
allow_extra_fields: false #default: false
allow_fields: ['name', 'surname', 'age'] #default: ~
allow_get_all: true #default: true
allow_batch: true #default: true
versions
- define multiple API versions. Version name will correspond to first url parameter e.g./v1
You should be consistent with version naming. Think of version naming conventions and stick to them e.g.
v1
,v2
,v2.2
...
-
endpoints
- here you can define multiple API endpoints. Name will correspond to second url parameter, e.g./v3/product
. One endpoint is responsible for one elasticsearch type unless you specify custom controller see [more info here][2]. -
repository
- elasticsearch respository service name, e.g.es.manager.default.product
-
methods
- a list of methods that that API support, each HTTP method represent action with the resource. e.g. PUT will update and create, DELETE will remove by id and etc.. -
allow_extra_fields
- when it's true, basically it turns of document structure validation. To use it, it's necessary to create dynamic mapping for yourelasticsearch
type and configureelasticsearch
to accept fields that are not from the mapping. -
allow_fields
- if this option is set, API will allow only to operate with specified fields from the type. -
allow_get_all
- adds_all
to the endpoint and allows to get all values. Please keep in mind that results with_all
will be paginated, be default you will get only 10 documents. You can setsize
andfrom
to modify output. -
allow_batch
- adds_batch
to the endpoint. You can sent then an array of documents to be indexed to the particular endpoint type.
Let's learn more about endpoints.