Loopback4 connect to Elasticsearch

时光总嘲笑我的痴心妄想 提交于 2019-12-21 05:00:21

问题


How to connect loopback4 server app with Elasticsearch DB.

I have tried with below reference links. but they have not explained for loopback4. And have did same implementation using below references but not able creating mapping properly to fetch records.

https://loopback.io/doc/en/community/Elasticsearch-connector.html

https://github.com/strongloop-community/loopback-connector-elastic-search/tree/feature/esv6

{
  "name": "customer",
  "connector": "esv6",
  "index": "index_name",
  "hosts": [
    {
      "protocol": "http",
      "host": "127.0.0.1",
      "port": 9200
    }
  ],
  "apiVersion": "6.5",
  "defaultSize": "100",
  "requestTimeout": 30000,
  "log": "trace",
  "mappingType": "basedata",
  "mappings": [],
  "mappingProperties": {
    "......."
    "id": {
      "type": "keyword",
      "index": true
    },
    "docType": {
      "type": "keyword",
      "index": true
    }
  }
 }
}

And my model having same id property like this

@property({
    type: "string",
    id: true,
    generated: true,
  })
  id: string;

using => "loopback-connector-esv6": "^1.3.0"

i am able to create (POST) a model object with auto generated id (_id).. but using this id/_id, we are not able to GET find/fetch any data. except create (POST) other APIS are not working..

So could you please suggest to help on this .. how to mapping model properties to Elasticsearch DB using loopback4.

来源:https://stackoverflow.com/questions/55338681/loopback4-connect-to-elasticsearch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!