Skip to content
Pulkit Singhal edited this page Sep 26, 2016 · 9 revisions

FAQs Index:

Question1

In the example I don't see any reference of where the model-config.json is modified

Answer

Let's say your model-config looks like:

{
    ...
    "User": {
        "dataSource": "db"
    },
    "AccessToken": {
        "dataSource": "db",
        ...
    },
    "ACL": {
        "dataSource": "db",
        ...
    },
    "RoleMapping": {
        "dataSource": "db",
        ...
    },
    "Role": {
        "dataSource": "db",
        ...
    },
    "UserModel": {
        "dataSource": "db"
    }
}

Since each of the following sample datasource files define the name of the datasource to be db ... there is nothing for you to change!

BUT if you're looking at https://github.com/strongloop-community/loopback-connector-elastic-search/blob/master/examples/server/datasources.json#L7 and want to change based on that then you may edit model-config.json like so:

{
    ...
    "User": {
        "dataSource": "elasticsearch-plain"
    },
    "AccessToken": {
        "dataSource": "elasticsearch-plain",
        ...
    },
    "ACL": {
        "dataSource": "elasticsearch-plain",
        ...
    },
    "RoleMapping": {
        "dataSource": "elasticsearch-plain",
        ...
    },
    "Role": {
        "dataSource": "elasticsearch-plain",
        ...
    },
    "UserModel": {
        "dataSource": "elasticsearch-plain"
    }
}

Question2

Why aren't multiple indexes supported or why is the name of ONE index required for the setup? Seems strange to me.

Answer

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.

Issue #47 is an example where a community user attemtps to offer a solution and discussion is ongoing at the moment.

Update

Multiple indexes supported since release v1.1.0. But please be aware that dynamix indexes: Issue #47 are still different and more advanced and not implemented.

Clone this wiki locally