Skip to content

Instantly share code, notes, and snippets.

@rishiloyola
Created January 20, 2016 16:18
Show Gist options
  • Save rishiloyola/a6f4ae25e8db6c0ea9d8 to your computer and use it in GitHub Desktop.
Save rishiloyola/a6f4ae25e8db6c0ea9d8 to your computer and use it in GitHub Desktop.
this.getSuggestions = function(text) {
return appbaseRef.search({
index: 'checkin',
body: {
suggest: {
mysuggester: {
text: text,
completion: {
field: 'city_suggest'
}
}
}
}
});
}
this.getSearchCheckin = function(text) {
return appbaseRef.search({
index: 'checkin',
type: 'city',
body: {
query: {
match: {
city: text
}
}
}
});
}
this.getliveData = function() {
return appbaseRef.searchStream({
type: 'city',
body: {
query: {
match_all: {}
}
}
});
}
this.getDragData = function(lat, lng) {
return appbaseRef.search({
type: 'city',
body: {
query: {
filter: {
geo_distance: {
distance: "2000km",
location: [lat, lng]
}
}
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment