Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Matt Huijsse
    @chetverikov thanks for your answer, but that is not the question I asked, I have now figured it out, I needed to make an embedded schema to manage the phones.
    Matt Huijsse
    anyone know why im getting a 500 error when trying to PUT my phone numbers into my nested schema?
    Quentin Hayot

    Hi guys !
    I'm trying to filter against a geo_point (geo_coordinates) which is nested in an object (Location), which is nested in an array in the queried object (MyObject).
    The problem is that the mapping for the object MyObject does not see the geo_coordinates field as a geo_point:

    // Index mapping for object MyObject
    "myobjects": {
        "mappings": {
          "myobject": {
            "properties": {
                "locations": {
                "type": "nested",
                "include_in_parent": true,
                "properties": {
                    "geo_coordinates": {
                    "properties": {
                      "lat": {  "type": "double" },
                      "lon": { "type": "double" }
    // Index mapping for object Location 
    "locations": {
        "mappings": {
          "location": {
            "properties": {
              "geo_coordinates": {
                "type": "geo_point"

    The object A looks like this:

    var MyObjectSchema = new Schema(
        locations: {
          type: [{ type: Schema.Types.ObjectId, ref: 'Location', es_schema: LocationSchema.schema}],
          es_type: 'nested',
          es_include_in_parent: true

    The object Location looks like this:

    var LocationSchema = new Schema(
      geo_coordinates: {
          type: {
            geo_point: {
              type: String,
              es_type: 'geo_point',
              es_lat_lon: true
            lat: {type: Number, default: 0},
            lon: {type: Number, default: 0}
          es_type: 'geo_point'

    My query looks like this:

    // POST http://ES-endpoint/locations/_search
        "query": {
            "filtered" : {
                "query": {
                        "match_all" : {}
                    "filter" : {
                        "geo_distance" : {
                            "distance" : "20000km",
                            "locations.geo_coordinates" : {
                                "lat" : 40,
                                "lon" : -70
                            } }  }  } }}

    I must miss something, but what ? :(
    PS: When exploring the indexes with Kibana, both objects have the same data for geo_location:

    "geo_coordinates": {
              "lat": x.xxxx,
              "lon": y.yyy
    Aravind Suresh
    hi can someone suggest me the best mongoose auto increment library
    This message was deleted

    I have this search query:

                            query: {
                                query_string: {
                                    fields: ["movieName"],
                                    default_operator: "AND",
                                    query: searchInput

    How do I add a synonym filter to this?

    Hi @all
    i use esTruncate method to delete all documents. But it seems only delete some documents (not all) on calling.
    BuildingModel.esTruncate(err => {
              if (err) console.log(err);
    This message was deleted

    Hi guys, if I specify to populate a model using Mongoosastic, what is the behavior?

    User.plugin(mongoosastic, {
    populate: [
    {path: 'comments', select: 'title body'}

    When I perform a search, does "comments" first get populated, then the search occurs? Therefore, will the search consider strings inside User.comments._somefield?

    "aggs" : {
    "productAttributes" : {
    "terms" : {
    "field" : "productBrand",
    "size" : 0
    nested: QueryParsingException[[ecommerceproductss] No query registered for [aggs]];
    guys can any body solve this?
    Hi everyone
    Good day
    I've been having an issue with syncing updates in mongoosastic
    It is exactly as described here:
    Balaji Jinnah
    Hi guys I'm getting timeout error can anyone help me with this??
    Elastic server is up and running
    David Novicki

    Does anyone know how to implement mongoosastic in keystonejs? I am getting an error in mongoosastic when trying to populate. KeystoneJS wraps mongoose schema and not sure the needed mongoose functions are there. Any insight would be awesome

    category: {
                type: Types.Relationship,
                ref: 'ProductCategory',
                index: true,
                many: true,
                es_schema: ProductCategory,
                es_indexed: true,
                es_type: 'nested',
                es_include_in_parent: true

    Error in mongoose library happens in this function

      function postSave (doc) {
        let _doc
        function onIndex (err, res) {
          if (!filter || !filter(doc)) {
            doc.emit('es-indexed', err, res)
          } else {
            doc.emit('es-filtered', err, res)
        if (doc) {
          _doc = new doc.constructor(doc)
          if (populate && populate.length) {
            populate.forEach(populateOpts => {
            _doc.execPopulate().then(popDoc => { //error happening here
          } else {
    Product.schema.plugin(mongoosastic, {
        hosts: [
            'host here'
        populate: [
            {path: 'category'}


    Meher Chandan
    Hi all..
    I am new in mongoosastic and need a little help.
    I have to two schemas..User and Post.. each post has a reference to User with author field.
    Now I want to hydrate the author(all details available in User for that objectID) on requesting Post..
    It's always giving me objectID and not the actual data.
    jean-baptiste demonte
    hi all, does anyone know how to index simple nested objects? Examples from here: https://www.npmjs.com/package/mongoosastic#indexing-nested-models and here: https://www.npmjs.com/package/mongoosastic#elasticsearch-nested-datatype didn't help me. As I correctly understand this is open issue: mongoosastic/mongoosastic#136
    After saving in elastic I can't search by reporter's name/email fields.
    const caseSchema = new Schema({
        title: { type: String, required: true, es_indexed: true },
        description: { type: String, required: true, es_indexed: true },
        tags: [{ type: String, es_indexed: true }],
        reporter: {
            // need to index this nested structure
            name: { type: String, required: true },
            email: { type: String, required: true }
    caseSchema.plugin(mongoosastic, {
        esClient: esClient,
        hydrate: true,
        hydrateOptions: { lean: true }
    Also I tried to use this method https://www.npmjs.com/package/mongoosastic#indexing-mongoose-references
    After data saved inside elastic I see smth like this http://prntscr.com/esssp1, but I can't search by reporter, too
    Alexis A. Banaag Jr.
    any ideas, I got this error
     Uncaught TypeError: _doc.index is not a function
          at Query.postSave (node_modules/mongoosastic/lib/mongoosastic.js:260:14)
          at next (node_modules/kareem/index.js:182:14)
    this happens when I try to update record.
    Alexis A. Banaag Jr.
    hi, we are using mongoosastic but upon checking our server we noticed that there are loads of open connection for Elasticsearch. Is it safe to assume that mongoosastic is causing this? if it is is there a way to limit or handle this?
    Javier Richard Cuicapuza Antonio
    Hi all :)
    Manoj Kumar
    Anyone here
    Manoj Kumar
    Mohamed Abd El Raouf
    Hi All,
    I just want to ask if there is anyway to check indexing status?
    Hi! Is there a way to get the top recent search terms?
    @/all I'm pleased to announce that we have a new version with all its deps updated and the tests are passing again.
    Zamiul Hasan
    @guumaster is this repo still active?
    Nicolaie Constantinescu
    Seems all dead here...
    Sajad Ghawami
    Moussa Traore
    I am facing big troubles using the API ... For some reason I am unable to use the function search on my model
    const ProductModel = db.model<IProduct>('Product', ProductSchema); ==> ProductModel.search
    does not work
    Hi, anyone know how to set the "total_fields.limit"?
    Dina Alaa
    hi every one, what should i write in the terminal to run mongoosastic server?