[英]Error while using searchKitManager in React
I am trying to use the searchKitManager inside react-admin I provided the parameters etc according to the docs but when I run the code it throws errors.我正在尝试在 react-admin 中使用searchKitManager我根据文档提供了参数等,但是当我运行代码时它会引发错误。 Here is how the code works
这是代码的工作原理
http://localhost:3000
http://localhost:3000
上运行http://localhost:3006
http://localhost:3006
http://localhost:9200
http://localhost:9200
上运行When data is inserted in mysql database using golang code it is also inserted in elasticsearch later on in one of my display component I call the above searchkitManager as follows当使用 golang 代码将数据插入 mysql 数据库时,它也会稍后在我的一个显示组件中插入 elasticsearch 我调用上面的 searchkitManager 如下
let apiUrl= 'http://localhost:9200/donate' // what link should I pass, url to elasticsearch or url to my backend
const searchkit = new SearchkitManager('/', {
searchUrlPath: `${apiUrl}/_search`,
});
This code will throw 404 Not Found or 400 Bad Request
error but the API works in postman if I change the above link to此代码将抛出
404 Not Found or 400 Bad Request
错误,但如果我将上述链接更改为
let apiUrl= 'http://localhost:9200/donate' // what link should I pass, url to elasticsearch or url to my backend
const searchkit = new SearchkitManager('/', {
searchUrlPath: `${apiUrl}/_doc/`,
});
I am not getting anything at all sometimes it no error in console and sometimes 400 Bad Request or 405 Post Not Allowed
我什么也没得到,有时控制台中没有错误,有时
400 Bad Request or 405 Post Not Allowed
One last thing the link I am providing as for searchUrlPath
should be like that or not?最后一件事我提供的关于
searchUrlPath
的链接应该是这样吗? or should I pass the apiUrl
in place of /
?还是我应该通过
apiUrl
代替/
? I tried that as well but just to make sure.我也试过了,但只是为了确保。
Any kind of help will be really appreciated.任何形式的帮助将不胜感激。
Try doing this:尝试这样做:
const elasticSearchUrl = 'http://localhost:9200/<your_index>';
const searchkit = new SearchkitManager(elasticSearchUrl );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.