Elasticsearch API


I read the pinged messages on this forum but am still not sure if this is the right place to ask. Apologize if I still make it wrong. Below is question.

Basically I want to expose elasticsearch API to client. (I am aware tool like ramses, but that require edit schema, but my elasticsearch schema is fairly complicated and long.) So I am interested if there exists any tools that help convert elasticsearch mapping to RAML?


Edit: or can I just delegate call to backend elasticsearch restful call? For instance RAML’s api /search_by_id encapsulates elasticsearch’s restful call curl http://localhost:port/index/type -d {... json call } -H "Content-Type:application/json"?


I want to expose elasticsearch API to client

may I ask which client? what are you trying to achieve?


If elastic search has a public API (not sure if they expose one?) you first need to make sure that whatever port they use isnt one you use for another service… e.g. your own API resources. If that is the case, it is likely your service is blocking the path to the elastic service and all you would need to do is change the port, or set up something like an nginx port forward in front of both your API and the elastic API so that you expose one port to both APIs.

What you suggest is also doable… you could provide as part of your own API defined with RAML, some simpler or specific resources that then make calls to your elastic, possibly aggregating the response data from elastic and returning it untouched or modified as you see fit. Maybe the default elastic response is too noisy, so you define a response type (again in RAML Type), and then your code builds up the RAML Type response and returns it via your API response.

It really depends if you want to clamp down their API, expose it, and how it is all deployed.