3

I'd like to use reactivesearch with my own plain vanilla elasticsearch cluster. While the example and documentation describe that this should be possible: ReactiveBase, see the url Param. I get connection errors and a Websocket call wss://.. which looks like ReactiveBase is trying to connect to a appbase.io hosted elastic instead. It also passes a credentials code along with the call to elastic which is not specified in my code.

Is it possible to connect to a normal elastic and where can I find the documentation on how to do this?

This is my definition of ReactiveBase:

<ReactiveBase app="documents"url="https://search-siroop-3jjelqkbvwhzqzsolxt5ujxdxm.eu-central-1.es.amazonaws.com/">

Connection Errors

To implement this example I followed the ReactiveSearch Quickstart

paweloque
  • 18,466
  • 26
  • 80
  • 136

1 Answers1

7

Yes, it's possible to connect to a normal Elasticsearch cluster (docs) with reactivesearch. It seems you're using the correct props. Sample code:

<ReactiveBase
  app="your-elasticsearch-index"
  url="http://your-elasticsearch-cluster"
>
    <Component1 .. />
    <Component2 .. />
</ReactiveBase>

The app prop refers to the index name. Looks like you're using this with AWS. Since AWS doesn't allow you to configure ES settings, you might need to use a middleware proxy server. From the docs:

If you are using Elasticsearch on AWS, then the recommended approach is to connect via the middleware proxy as they don’t allow setting the Elasticsearch configurations.

The docs also explain how you can write your own proxy server.

TLDR:

The connection error related to websockets you see here isn't causing the issue. It's used for streaming which works on appbase.io. This has been fixed in the 2.2.0 release. Hope this helps :)

Divyanshu Maithani
  • 13,908
  • 2
  • 36
  • 47
  • Can you please help me to connect to my Elasticsearch AWS cluster @Divyanshu ? I dont find so much information or examples about it... In my ReactiveBase I have add the app='my-index' and in the url I put the cluster url, but I cant get the information of the indexed documents and I dont have errors in the console. – Laura Feb 25 '19 at 03:18
  • 1
    Hi, last I remember, the connection should work with just the `app` and `url` prop. Could you please share a codesandbox example if you want me to take a look or perhaps someone in the [gitter](https://gitter.im/appbaseio/reactivesearch) channel – Divyanshu Maithani Feb 25 '19 at 09:24
  • Hi @Divyanshu , Thanks! This is my codesanbox https://codesandbox.io/s/kmj2q5n2vr?fontsize=14 – Laura Mar 17 '19 at 23:48
  • 1
    Hey @Laura the app is working fine. Just remove the `autosuggest={false}` prop in `DataSearch` and you should be able to see the suggestions. – Divyanshu Maithani Mar 18 '19 at 06:13
  • Oh...thanks so much @Divyanshu ! Just another question please! Do you know why this is not working? https://codesandbox.io/s/kmj2q5n2vr ? It works fine if I delete ResultCard component – Laura Mar 18 '19 at 23:09
  • 1
    Seems like you're using a newer version which has a different API. For example the `onData` prop has been removed it seems. Could you please check from the docs? I'm not aware of the new API either. – Divyanshu Maithani Mar 19 '19 at 05:07
  • I have seen this, which was published 5 days ago: https://github.com/appbaseio/reactivesearch/issues/885 But I Dont know how to change my package.json to achieve this goal : https://codesandbox.io/s/kmj2q5n2vr – Laura Mar 23 '19 at 20:09
  • 1
    You can just change the dependency version in package.json – Divyanshu Maithani Mar 24 '19 at 14:51
  • It works, @Divyanshu. Thanks! Can you please take a last view to my code? https://codesandbox.io/s/3401jp81pm I have added a Reactivemaps component but it does not work. Im sorry for all these questions... – Laura Mar 30 '19 at 02:15