react-elasticsearch
react-elasticsearch copied to clipboard
Connection with local base
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?
I am experience a similar issue
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.
yes, same issue with http://localhost:9200/myindex ! My test request with postman work fine. Any ideas?
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
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