Get Free Trial
Get Free Trial

cannot connect from flexmonster to elasticsearch

Answered
Marc Wentinck asked on June 14, 2019

I have tried different versions of elasticsearch, remote 6.5.4, locally via docker 7.1.1 , I have set CORS, I am using flexmonster 2.7.7 and ng-flexmonster 2.7.7 what ever I do I get this error:
 
 

“ReferenceError: elasticsearch is not defined
at eval (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:854866)
at Function.G3O.load (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:148795)
at u1s.KN (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:854817)
at Z3o.load (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:805112)
at S1.connect (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:1450255)
at R3.Sha (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:1420506)
at R3.vx (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:1419784)
at R3.d_ (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:1419619)
at R3.Pha (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:1419476)
at R3.Iz (webpack-internal:///./node_modules/ng-flexmonster/node_modules/flexmonster/flexmonster.full.js:12:1418867)”
 
I have no idea what it means, and the modules are compressed to I have no idea what is going in that call stack. Does this look familiar to anyone?
 
This is the typescript code I am using:
public onClickFillTestTable() {
//alert(‘loading table’);
let report: Flexmonster.Report = {
“dataSource”: {
“dataSourceType”: “elasticsearch”,
“host”: “https://elastic05.companyname.office:9200/”,
“index”: “indexname”
},
};
this.testpivot.flexmonster.setReport(report);
}
 

3 answers

Public
Vera Didenko Flexmonster June 14, 2019

Hello,
 
Thank you for reaching out to us.
 
We would like to point out that our team has provided a fix for this issue and added it to the latest released version of Flexmonster.
 
Please try with the version 2.7.7-2 of Flexmonster. The issue should be resolved here.
 
Let us know if this works.
 
We are looking forward to hearing from you.
 
Best Regards,
Vera

Public
Marc Wentinck June 14, 2019

Hello Vera,
I think I at least got a step further yes. I reinstalled version 2.7.7 and now I have got another message:
 
Access to XMLHttpRequest at ‘http://elastic05.olbico.office:9200/vehicle_nl/_mapping’ from origin ‘http://localhost:64965’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
 
Which surprises me because I am aware of this and thought I did that correctly:
https://www.flexmonster.com/doc/connecting-to-elasticsearch/
Step 2: Enable cross-origin resource sharing (CORS)
 
But I will recheck if I have done this correctly.
 
 
 

Public
Vera Didenko Flexmonster June 18, 2019

Hello,
 
Thank you for your reply.
 
Our team kindly suggests to do the following:
 
1) check elasticsearch.yml that all of the following is added:

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-credentials: true
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"

2) check that elasticsearch server was restarted so that the new configuration is applied.

3) check dev tools in chrome (Network tab) to verify that CORS headers (Access-Control-Allow-Origin) are present in the response.
 
Please let us know if this helps to get everything working.
 
Best Regards,
 
Vera

Please login or Register to Submit Answer