Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Alejandro
    @Alejandro_ST_17_twitter
    Hi! One question: it's possible to make ELS aggregations using this connector? Thanks so much.
    Pulkit Singhal
    @pulkitsinghal
    you could make any sort of request using native keyword but massaging the result you get back to give you aggregations is tricky and has not been through or implemented

    so i would have to say:

    no @Alejandro_ST_17_twitter its not possible to perform ELS aggregations using this connector

    there is no good out-of-the-box support for this ... its not impossible with some thought and vision but i cannot imagine what method name i should expose such support under and what all might be useful for different folks :(

    if you want to mess around and submit a PR, i would welcome it
    HarenderDudi
    @HarenderDudi
    hi, can anyone help me with how to get elasticsearch document lock using java
    Steven
    @onstrike07
    I did some aggregations by a kind of hard-coding way. I passed a parameter like 'aggtype' to the connector, and check this parameter in ESConnector.prototype.all function. If this parameter is provided, then do your aggregation queries and return result. If not, just do regular query.
    image.png
    Pulkit Singhal
    @pulkitsinghal
    @HarenderDudi - i cannot help with this topic ... maybe you might find more help on an ES + java forum? i hope someone here who knows responds too :)
    Shundan Xiao
    @sherryxiao1988
    do we support elastic search 5.x yet?
    Steven
    @onstrike07
    I don't have an official answer. I made a quick test on ES 5.4 and it seems work. I just did a query and the connector could return expected results. Haven't tested more yet.
    Shundan Xiao
    @sherryxiao1988
    thanks! @onstrike07 worked for me too. i put 5.x in apiVersion
    another question, I am trying to test the GET call, what should I put in filter? my query string wasn't built correctly no matter what I put there.
    {"body": {"query": {"match": {"title": "Futuro"}}}}
    {"q" : "Futuro"}
    ^ neither of them works
    Steven
    @onstrike07
    if you are testing it from Explorer, try {"where": {"title":"Futuro"}}, if you are calling the api from javascript, you need to use "filter" to enclose it, like {"filter": {"where": {"title": "Futuro"}}}
    Steven
    @onstrike07
    I connected the connector to a username and password protected ES 5.5 instance. I got error, as listed below, when I did a query.
    Steven
    @onstrike07

    Elasticsearch DEBUG: 2017-10-11T02:51:52Z
    starting request {
    "method": "POST",
    "path": "/alive-time-nginx-access/events/_search",
    "body": {
    "query": {
    "match_all": {}
    }
    },
    "query": {
    "size": 50
    }
    }

    Elasticsearch TRACE: 2017-10-11T02:51:52Z
    -> POST http://[username:password2217@10.10.10.10]:9200/alive-time-nginx-access/events/_search?size=50
    {
    "query": {
    "match_all": {}
    }
    }
    <- 0

    Elasticsearch ERROR: 2017-10-11T02:51:52Z
    Error: Request error, retrying
    POST http://username:password@10.10.10.10:9200/alive-time-nginx-access/events/_search?size=50 => getaddrinfo EAI_FAIL username:password@10.10.10.10:9200
    at Log.error (E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\log.js:225:56)
    at checkRespForFailure (E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\transport.js:240:18)
    at HttpConnector.<anonymous> (E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\src\lib\connectors\http.js:1
    62:7)
    at ClientRequest.wrapper (E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\node_modules\lodash\lodash.js:49
    68:19)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at connectErrorNT (net.js:1022:8)
    at E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback\node_modules\loopback-context\node_modules\continuation-local-storage\node_modules\async-listen
    er\glue.js:188:31
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)

    Elasticsearch TRACE: 2017-10-11T02:51:52Z
    -> HEAD http://[username:password@10.10.10.10]:9200/

    <- 0

    Elasticsearch WARNING: 2017-10-11T02:51:52Z
    Unable to revive connection: http://username:password@10.10.10.10:9200/

    Elasticsearch WARNING: 2017-10-11T02:51:52Z
    No living connections

    Trace: No Living connections
    at E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\lib\esConnector.js:874:19
    at tryCallOne (E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\node_modules\promise\lib\core.js:37:12)
    at E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\node_modules\promise\lib\core.js:123:15
    at flush (E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback-connector-es\node_modules\elasticsearch\node_modules\promise\node_modules\asap\raw.js:50:2
    9)
    at E:\Dropbox\Dropbox\Programming\password\api\node_modules\loopback\node_modules\loopback-context\node_modules\continuation-local-storage\node_modules\async-listener
    \glue.js:188:31
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:122:9)
    Elasticsearch TRACE: 2017-10-11T02:53:17Z
    -> HEAD http://[username:password@10.10.10.10]:9200/

    Here is the datasource:
    "eventlog": {
    "name": "eventlog",
    "connector": "es",
    "index": "alive-time-nginx-access",
    "hosts": [
    {
    "host": "username:passoword@10.10.10.10",
    "port": 9200
    }
    ],
    "apiVersion": "5.0",
    "log": "trace",
    "defaultSize": 50,
    "requestTimeout": 30000
    }
    Pulkit Singhal
    @pulkitsinghal
    Thanks for helping others Steven, I’ll try to find an engineer in my team to ramp up on ES connector to help out by end of this week.
    If I can find someone who is bored with plain office work and wants some open source excitement to go along with it then it’ll be a win-win
    Steven
    @onstrike07
    Thanks boss!
    Steven
    @onstrike07
    I fixed this issue by modifying the "hosts" part in datasource.json, as shown below,
    Vladimir Sazonov
    @sazik-rzn
    hi friends! how make query like mysql's "WHERE id IN (1,2,3,4,5,...)"?
    Leonardo Alvarez
    @leoalvarez81

    Hi there, Could someone help me?
    How can I make Create or Update requests? Something like

    POST /my-index/my-type/<id>
    {
      "body": "foo"
    }

    When I use the loopback model API PUT /MyModel/<id>, I get an error

    {
      "error": {
        "statusCode": 500,
        "name": "Error",
        "message": "The connector elasticsearch does not support replaceById operation. This is not a bug in LoopBack. Please contact the authors of the connector, preferably via GitHub issues.",
     ...
    }
    Leonardo Alvarez
    @leoalvarez81
    Also, I would prefer not to do the 2 steps: checking if exists with GET, then use the PATCH API.
    Pulkit Singhal
    @pulkitsinghal
    Is there a mixin for reset password? Or rather is it possible to implement reset password via a mixin approach?
    caiyufei
    @caiyufei
    We plan to connect elasticsearch in loopback framework , but https://github.com/strongloop-community/loopback-connector-elastic-search has NOT been updated since June 2017 , Will it be deprecated ?
    @raymondfeng In loopback framework project, connect ES , insert into ES , query data from ES , any connector to use ? https://github.com/strongloop-community/loopback-connector-elastic-search has NOT been updated since June 2017 , Will it be deprecated ?
    Pulkit Singhal
    @pulkitsinghal
    Hello @caiyufei, it’s a community plugin. As a contributor I have at least no plans to deprecate it. Contributions from the community come in the form of PRs and if we are lucky then they also come with tests. If we are even luckier then we see at least one other contributor like @aquid look over the code, run the tests and give a thumbs up for code review. The process is slow because the contributors have day jobs and loopback experts at IBM themselves haven’t yet made any commitment to helping with code reviews, which is fine.

    Do you think you have a good background to be an active contributor either from features contributions perspective or from a code reviewer perspective?

    If your answer is yes from a code reviewer perspective then please ask the loopback team to make you a direct contributor to the project. I do not have such a privilege.

    caiyufei
    @caiyufei
    Hi, @pulkitsinghal , Thanks for your quick reply. Our search project is using loopback framework and is looking for a plugin or something else to connect to Elasticsearch. Thanks for your loopback-connector-elasticsearch. We decide to try to use it. If we have requirement to add/update features we will contribute.
    caiyufei
    @caiyufei
    @pulkitsinghal Do you have any plan to upgrade elasticsearch client from version 12 to 14 , the v14 supports ES api 6.0
    Shubham Thakur
    @sbmthakur
    Hi @caiyufei , I've submitted a PR upgrading the client. You can follow the progress here: strongloop-community/loopback-connector-elastic-search#106
    Steven
    @onstrike07
    I'm not sure if there is any improvement on aggregation support in the latest connector. If not, I have an idea on it by using native keyword. The current version doesn't work for aggregation even you use native keyword because the connector always returns hits.hits from the result body. It should return aggregations node for an 'aggs' query. To fix it, we can just check availability of 'aggregations'. If it's true, return it; otherwise, does normally.
        function (body) {
          if (body.aggregations)
          {
            return done(null, body.aggregations) ;
          }
          var result = [];
          body.hits.hits.forEach(function (item) {
    I tested it and it worked.
    image.png
    Pulkit Singhal
    @pulkitsinghal
    This message was deleted
    Bharath Reddy Kontham
    @bharathkontham
    hi all
    I've updated plugin to support Elasticsearch 6.x
    Will update documentation soon
    Pulkit Singhal
    @pulkitsinghal
    Thanks for contributing!
    Bharath Reddy Kontham
    @bharathkontham

    An overview on updates in https://github.com/bharathkontham/loopback-connector-elastic-search

    • Only Elasticsearch 6.x is supported, ES 5.x or older version may or may not work.
    • Currently only one Index can be configured in one ES datasource of loopback (working on multiple indices configuration support) but we can use same datasource multiple loopback models.
    • A keyword field "docType" is used to store model names which provides support to use same Mapping Type of a single index for storing multiple models. This is major change in connector as earlier version used different mapping types to store different loopback models.
    • Nested objects querying (array of objects type in loopback), geo spatial queries and like, nlike are supported.

    I'll update examples and documentation soon.

    I'm working only on ElasticSearch 6.x or later support (no intention to work on older versions)

    Sample query for nested objects and geo_spatial:

    { "where": { "and": [ { "address.geo": { "geo_shape": { "address.geo": { "shape": { "type": "circle", "coordinates": [ 78.38214860577659, 17.44064909837838 ], "radius": "1km" }, "relation": "within" } } } }, { "entity_properties.value": { "gt": 50 } } ] } }

    entity_properties is a nested object and address is an object.
    address.geo has geo_shape data.

    Bharath Reddy Kontham
    @bharathkontham

    Updated example for Elasticsearch 6.x in https://github.com/bharathkontham/loopback-connector-elastic-search

    Please check examples/server/datasources.sample-es-6.js

    Pulkit Singhal
    @pulkitsinghal

    @bharathkontham - would you like to be added as a contributor to the strongloop community repo so that you can own and release 6.x related work more quickly?

    Since you will only focus on 6.x and I cannot just nuke the other versions ... We can create a branch for 6.x development and perform 6.x releases from it or I am open to other ideas too.

    Let us know.

    Bharath Reddy Kontham
    @bharathkontham
    @pulkitsinghal - I would like to work on that, add me to strongloop community.
    Pulkit Singhal
    @pulkitsinghal
    1. Soon I will cut a branch
    2. Ask for you to be added as a contributor
    3. Document which branch to merge your PRs into for your 6.x work ... also for any other users and contributors that come along.
    Can’t commit to a imprint but that’s the plan :)