YousefED / ElasticUI

AngularJS directives for Elasticsearch
http://www.elasticui.com
Other
526 stars 138 forks source link

Using elasticiu on the REST API #71

Closed Guisardo closed 8 years ago

Guisardo commented 8 years ago

Hi there, I really like elasticui, but to be able to put it in production I need some way to set that all the querys had to be done by GET to the search REST API of elastic search. This allow me to use cache systems like varnish and also allow me to secure the elasticsearch cluster. Is this possible? How may I help to make this possible? Best,

osterman commented 8 years ago

I'm looking into this right now. I am using NodeJS+express so tried using express-http-proxy to pass GET and OPTIONS on /<index>/*, but no luck.

YousefED commented 8 years ago

Hi. What is the exact issue / error? ElasticUI was designed for the REST api and should work seemlessly with it. It hasn't been tested on elasticsearch 2+ yet though, maybe there's an issue there?

Guisardo commented 8 years ago

Hi @YousefED , this is more of a question then. How can we use ElasticUI only with using the GET method instead of the POST? Can you add some example to the docs? Best,

YousefED commented 8 years ago

not possible I think:

http://stackoverflow.com/questions/22535324/nodeelasticsearch-sending-a-body-on-a-get-request https://github.com/elastic/elasticsearch-definitive-guide/issues/64

Recommended to configure your proxy to only allow requests (incl. POST) to /_search/

Guisardo commented 8 years ago

The problem is that POST are not cacheable. So personally I had end up using directly the search method of elasticsearch.js: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search

Sending the q instead of the body makes the request by GET. Although it works, I'd to make the queries manually. Is there any way to use this method with ElasticUI ?