reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

Provide an example with a local elasticsearch instance

Open bstaats opened this issue 9 years ago • 8 comments

Have not been able to find an example from anywhere yet. -Thanks

bstaats avatar Oct 19 '17 17:10 bstaats

<ReactiveBase url="http://localhost:9200/" app="app name" type="type name">

  • Remeber that an appbase "app" is synonymous with an ES "index"
  • Make sure that you are on version 1.0

aaronmyhre avatar Oct 19 '17 17:10 aaronmyhre

So perhaps something else is going on cause I thought it was that simple too.

With this code: <ReactiveBase app="reactiveapp" url="http://localhost:9200" type="purchases" theme="rbc-blue">

I get the following error: VM1059:164 WebSocket connection to 'ws://localhost:9200/reactiveapp' failed: Error during WebSocket handshake: Unexpected response code: 404

I have also tried putting my ES index in "app" as well and I get the same error.

ES is running locally: curl -XGET http://localhost:9200/ { "name" : "2tnQjI6", "cluster_name" : "elasticsearch", "cluster_uuid" : "7kV95RtQRJK5Kpg90z1Y-g", "version" : { "number" : "5.6.2", "build_hash" : "57e20f3", "build_date" : "2017-09-23T13:16:45.703Z", "build_snapshot" : false, "lucene_version" : "6.6.1" }, "tagline" : "You Know, for Search" }

bstaats avatar Oct 19 '17 18:10 bstaats

@bstaats That error is likely because of the underlying library trying to maintain a realtime subscription, something appbase.io offers but a generic ES cluster wouldn't. It shouldn't have any effect on the functioning of the app.

siddharthlatest avatar Oct 20 '17 12:10 siddharthlatest

Yup, I looked at the underlying library and its connecting via a Websocket which ES does not accept. So the below article is misleading then. You are not able to connect reactivesearch components to ES. 😞 🐼

https://medium.appbase.io/reactive-search-v1-ui-components-for-elasticsearch-8d3506b534b2

bstaats avatar Oct 23 '17 16:10 bstaats

The websocket connection failure to ES host should have no material effect on the library's request making with ES or the library's working.

Are you not able to use it?

-Siddharth

On Mon, Oct 23, 2017 at 10:03 PM Brian Staats [email protected] wrote:

Yup, I looked at the underlying library and its connecting via a Websocket which ES does not accept. So the below article is misleading then. You are not able to connect reactivesearch components to ES. 😞 🐼

https://medium.appbase.io/reactive-search-v1-ui-components-for-elasticsearch-8d3506b534b2

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/appbaseio/reactivesearch/issues/104#issuecomment-338718309, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmdGgguf43szwSADFQdGWmzjMJ0EzNVks5svL_lgaJpZM4P_mSg .

--

written in the spirit of three.sentenc.es

siddharthlatest avatar Oct 23 '17 17:10 siddharthlatest

I don't know the specifics of your setup @bstaats, but I do have a working website with Reactive-Search pointed at a local version of ES....

aaronmyhre avatar Oct 23 '17 17:10 aaronmyhre

I was able to get it to work. The missing piece was setting the correct access control for my local environment. For example:

http.cors.enabled: true
http.cors.allow-credentials: true
http.cors.allow-origin: /https?:\/\/(localhost)?(127.0.0.1)?(:[0-9]+)?/
http.cors.allow-headers: X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization, Access-Control-Allow-Headers, Accept

bstaats avatar Oct 23 '17 21:10 bstaats

super helpful @bstaats thank you!

But what about the docs for how to setup your mappings? Obviously the data in your ES index and your mappings must conform to reactivesearch queries so wondering where I can read about how to setup the index & mappings.

The README say you can use "Any Elasticsearch index hosted on any Elasticsearch cluster."

kevinsproles avatar Oct 28 '20 23:10 kevinsproles