Absolute newb question about accessing elasticsearch results

I'm just scratching the surface of ES, so apologies if this is pedantic...

I've got it installed on my dev server, created an index, can get results on the command line, have a basic understanding of how it works. All good there.

My ultimate idea is to use it for site search. Which means I'll need to access ES results from the web somehow.

On this page a guy is describing how to pass it thru different server application layers:


Which makes sense if you're already using one of those on your webserver. But it looks like one of the possibilities is javascript. Using pure javascript makes sense because ES returns json which is easily handled by jquery. But I would think in that instance that 9200 would have to be open to the public. Which is obviously dangerous because of updates and deletes. OR are we talking server-side javascript here?

What I am getting at is, is it possible to safely access ES results with no server side abstraction layer?

or is this a really ugly newb question that indicates a total misunderstanding of the technology? :wink:

Generally no.

It is possible to write a query puts too much strain on the cluster so you really need to have something between the user and Elasticsearch. On the way back you can certainly forward it strait to the user and do client side formatting. You can even use Elasticsearch's response filtering to slim down the response to what you need. I'd prefer stuff like source filtering if it applies because that saves memory on the server, but it may not matter that much depending on load.

1 Like