loopback connector for ElasticSearch
Asked Answered
S

2

6

There are at least two different packages available on npm, loopback-connector-elastic-search and loopback-connector-es. I have not been able to connect my very basic Loopback api to my ES instance, and the sparse documentation on these two connectors is not helping.

Any guidance would be really appreciated on how I can create an API for my app using Loopback and ElasticSearch.

Sketchbook answered 14/5, 2015 at 2:52 Comment(1)
please accept the answer if it provided the solution you were seekingPerfidious
P
4

Originally loopback-connector-elastic-search was published by drakerian but hasn't been under development since Oct 1st, 2014 if you peek into the commits: https://github.com/drakerian/loopback-connector-elastic-search

loopback-connector-es is a fork from that original effort and is currently under active development so please use that. https://github.com/strongloop-community/loopback-connector-elastic-search

And you'll notice that it is hosted on github under strongloop-community which means it has a future even if the current author (me) gets hit by a truck :)

If even after referring to the instructions here: https://github.com/strongloop-community/loopback-connector-elastic-search#loopback-connector-elastic-search ... you have questions then just jump into the chat room to get some answers: https://gitter.im/strongloop-community/loopback-connector-elastic-search

Perfidious answered 14/5, 2015 at 13:30 Comment(10)
There is also an open-source project where I use the es connector, feel free to check out the source code in its feature/add-es-connector branch ... you'll probably get the most out of this file in particular (configuration-wise): github.com/ShoppinPal/warehouse/blob/feature/add-es-connector/…Perfidious
Why aren't multiple indexes supported or why is the name of ONE index required for the setup? Seems strange to me.Amniocentesis
Is it possible to run this connector without docker on localhost? Plus, in the example I don't see any reference of where the model-config.json is modified...Uke
Yes it is possible to run this connector without docker on localhost. docker-compose is only there to help you see that it works with minimal effort and help you decided if this project is worth your time before you commit to using it in your daily life. You will have to run your own elasticsearch on localhost and configure the connector to point at it, that's all. Again a chat room is available, try discussing there: gitter.im/strongloop-community/… model-config modification is simple and falls under basics of loopback & isn't covered by lb-es docsPerfidious
Make sure you take a look here too: github.com/strongloop-community/…Perfidious
@Amniocentesis - when the project started, the simplistic thinking was one index in ES is similar to one database in mongodb. One type in ES is similar to one collection in mongodb. ES usecases are bound to be more diverse than that, so the connector too should evolve. Does this thread address the same issue as yours or would the solution proposed there be helpful to you as well? github.com/strongloop-community/…Perfidious
@Perfidious Yes, the connector should be able to use elasticsearch as it was meant to be used. The current state cuts away 1/3 of the functionality, think about every user wants to search its data, you would like to open an index for every user.Amniocentesis
@Amniocentesis - if you could provide any input to help build upon the discussion to implement this here github.com/strongloop-community/…, that would be fantastic.Perfidious
Can we use this plugin to store only specific fields (fields that we want to index them)? and how we can implement it a real loopback model_name.json?Perform
I have this model: {"name": "JobPosting","plural": "JobPostings","base": "PersistedModel","idInjection": true,"options": {"validateUpsert": true},"properties": {"vacancyNumber": {"type": "string","required": true},"position": {"type": "string","required": true}},"validations": [],"relations": {"attachments": {"type": "embedsMany","model": "Attachment","property": "attachments","options": {"forceId": false,"validate": true,"persistent": false}},"posts": {"type": "hasMany","model": "Post","polymorphic": {"foreignKey": "shareableId","discriminator": "shareableType"}}}, "acls": [],"methods": {}}Perform
A
1

Loopback connector for elasticsearch is being maintained actively by me at https://github.com/strongloop-community/loopback-connector-elastic-search

But the connector package is published in npm under different name 'loopback-connector-esv6'. Here is the link https://www.npmjs.com/package/loopback-connector-esv6.

This connector supports both ElasticSearch 6.x and 7.x and requires minimum npm version 6.9.0.

This connector for now supports only Loopback 3.x and planning to Loopback 4.x in near future.

Askew answered 3/5, 2020 at 3:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.