-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace elasticsearch.angular.js with plain $http? #2
Labels
Comments
angular.module('elasticsearch', [])
.factory('esFactory', ['$http', '$q', function($http, $q) {
return function(clientOpts) {
return {
search: function(searchOpts) {
var defer = $q.defer();
$http({
method: 'POST',
url: clientOpts.host + searchOpts.index + '/_search',
params: {
size: searchOpts.size,
from: searchOpts.from
},
data: searchOpts.body.toJSON()
}).then(
function(body) {
defer.resolve(body.data);
},
function() {
defer.reject.apply(this, arguments);
}
);
return defer.promise;
}
};
};
}]); |
+1 |
Seems like a good idea indeed. Could you confirm the code by @psi-4ward works well with ElasticUI? |
@YousefED The Code worked in my case. |
I've moved this to a separate repository: https://github.com/YousefED/elasticsearch.angular.simple/, hope you don't mind :) I think it's a great addition but doesn't directly belong in ElasticUI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that elasticsearch.angular.js is only used to send Ajax Requests, which could also easily be done by using plain $http. Since this dependency has a size of a few hundred KB I ask myself if there is another benefit that I'm not aware of?
The text was updated successfully, but these errors were encountered: