react-elasticsearch icon indicating copy to clipboard operation
react-elasticsearch copied to clipboard

Connection with local base

Open victorjourne opened this issue 4 years ago • 5 comments

Your work looks great! I am trying to test it but I am unable to connect Elasticsearch component to my local index myindex locally exposed at http://localhost:9200. I have items with a field called title.

I tried your first example without results :

class App extends React.Component { render() { return ( <Elasticsearch url={"http://localhost:9200/myindex"} > <Results id="iga" items={data => data.map(item => <>{item.title}</>)} /> </Elasticsearch> ); } }

What do you suggest?

victorjourne avatar Apr 01 '20 12:04 victorjourne

I am experience a similar issue

JonathanReiss15 avatar Jul 12 '20 03:07 JonathanReiss15

Would it be possible to have a sample data file to use? Would help someone starting out with this tech to learn. Going to the URL specified wasn't clear for me. Thank you.

ttgiang avatar Jul 17 '20 19:07 ttgiang

yes, same issue with http://localhost:9200/myindex ! My test request with postman work fine. Any ideas?

YannickArmspach avatar Aug 11 '20 09:08 YannickArmspach

You may be experiencing a CORS issue.

Since you are developing locally you may have to add a proxy to your package.json

"proxy": "http://localhost:9200"

You would then only have to specify the index in the Elasticsearch components URL prop

<Elasticsearch url={"/some-awesome-index"}>

Further details here Proxying API Requests in Development

grahamplata avatar Oct 21 '20 16:10 grahamplata

Sorry for the late answer!

This may have been fixed in the latest version. See: https://github.com/betagouv/react-elasticsearch/issues/34#issuecomment-846898433

rap2hpoutre avatar May 24 '21 09:05 rap2hpoutre