I am using NPM elasticsearch to connect my app to elasticsearch. I am successfully indexing the data. And I get back the data I am expecting (my query works). But I can’t seem to send the data to the browser.
I made notes in the code below to clarify the issue.
Meteor.publish('searchContacts', function(searchContactsQuery) {
var groupId = Meteor.users.findOne({groupId: groupId}).group.group_id;
var query = {//working query inserted here};
EsClient.search({
index: 'contactsindex',
type: 'contacts',
size: 10,
body: {
query: query
},
}).then(function (body) {
var contactIds = _.pluck(body.hits.hits, '_id');
console.log(contactIds) //returns an array of ids as expected
return Contacts.find({_id: {$in: contactIds}}) //returns nothing to the browser
}, function (error) {
console.trace(error.message);
});
});
Thanks for pointing me in the right direction. I have used custom publications before but I am still having trouble with the implementation. Do you know of any specific code examples or tutorials I could look at?
I wanted to do the same and was able to get it working after a lot of trial and error. The problem is that I actually do not understand why this is working, so if someone could explain I would really appreciate it.