npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

roadiejs-elastic

v0.0.7

Published

Elasticsearch capabilities in RoadieJS

Downloads

6

Readme

roadiejs-elastic

A plugin for RoadieJS

Integrates RoadieJS with Elasticsearch's search, complete and aggregation capabilities.

Contents

API

searchAll (GET)

Searches all RoadieJS indexes using parameters supplied in the request.

Request

GET /search

Example http://localhost:3010/search?q=Walter&from=11&size=10&category=admin

Query parameters

| Parameter | Notes | ----- | ---- | q | Query string to filter results. Supports Elasticsearch's query_string syntax. | from | Zero-indexed offset for use when paginating results | size | Maximum number of documents returned | sort | Use to sort results. Some options: Give just a field name, and documents will be ordered by that field, ascending. Suffix with a :desc to make the order descending. Also supports comma delimitation for multi-field sorts. | refresh | Either true or false (the default). If refresh is true the index will be refreshed (e.g. wait until all outstanding document changes are resolved) before attempting the search. Useful if results are required instantly after a document has been updated. | category | Restrict the search to within the specified category | subCategory | Restrict the search to within the specified sub-category

Response

Status 200

  • The body of the response mirrors that of the results from the underlying Elasticsearch query.

searchAll (POST)

Searches all RoadieJS indexes, like searchAll (GET). except Elasticsearch DSL should be provided in the request body.

Request

POST /search

{
  refresh: true,
  query: {
    range: {
      "squareMiles": {
        "gt": 150000
      }
    }
  }
}
  • The body of the request should be valid Elasticsearch DSL.
Response

Status 200

  • The body of the response mirrors that of the results from the underlying Elasticsearch query.

searchIndex (GET)

Searches the specified index, using parameters supplied in the request.

Request

GET /search/:indexName

| Parameter | Notes | ----- | ---- | indexName | The name of a valid Elasticsearch index (without the roadiejs. prefix)

Query parameters

| Parameter | Notes | ----- | ---- | q | Query string to filter results. Supports Elasticsearch's query_string syntax. | from | Zero-indexed offset for use when paginating results | size | Maximum number of documents returned | sort | Use to sort results. Some options: Give just a field name, and documents will be ordered by that field, ascending. Suffix with a :desc to make the order descending. Also supports comma delimitation for multi-field sorts. | refresh | Either true or false (the default). If refresh is true the index will be refreshed (e.g. wait until all outstanding document changes are resolved) before attempting the search. Useful if results are required instantly after a document has been updated. | category | Restrict the search to within the specified category | subCategory | Restrict the search to within the specified sub-category

Response

Status 200

  • The body of the response mirrors that of the results from the underlying Elasticsearch query.

searchIndex (POST)

Searches the specified index, like searchIndex (GET). except Elasticsearch DSL should be provided in the request body.

Request

POST /search/:indexName

| Parameter | Notes | ----- | ---- | indexName | The name of a valid Elasticsearch index (without the roadiejs. prefix)

{
  refresh: true,
  query: {
    range: {
      "squareMiles": {
        "gt": 150000
      }
    }
  }
}
  • The body of the request should be valid Elasticsearch DSL.
Response

Status 200

  • The body of the response mirrors that of the results from the underlying Elasticsearch query.

findById

Returns a document with the matching id, from the specified index.

Request

GET /search/:indexName/:id

| Parameter | Notes | ----- | ---- | indexName | The name of a valid Elasticsearch index (without the roadiejs. prefix) | id | The id of an Elasticsearch document

Response

Status 200

  • The body of the response mirrors that of the results from the underlying Elasticsearch query.

complete

Delivers typeahead functionality based on Elasticsearch's Completion Suggester

Request

GET /complete/:indexName

| Parameter | Notes | ----- | ---- | indexName | The name of a valid Elasticsearch index (without the roadiejs. prefix)

Query parameters

| Parameter | Notes | ----- | ---- | text | The as-you-type text from which will be sent to Elasticsearch's Completion Suggester.

Response

Status 200

Activities

populateLookups

Used to derive a user-facing label from a Elasticsearch document, based on a stored id value.

Example
{
  "element": "activity",
  "id": "populateLookups",
  "path": "maintainTeacher",
  "config": {
    "activityType": "populateLookups",
    "config": {
      "targetActivityId": "showTeacherUi",
      "lookups": [
        {
          "field": "department",
          "schema": "departments"
        }
      ]
    }
  }
}
Config

| Name | Type | Notes | ------------ | -------| ----------- | targetActivityId | string | The id of an activity within the current flow, that is storing the id value to lookup in Elasticsearch. | field| string | Identifies which field stores the id value in the target activities data object. | schema| string | The 'child' schema defined in the blueprint, which should contain the id identified by field

Data tasks

elasticDocSync

Used to synchronise create/update/delete operations on schema documents with their counterparts in an Elasticsearch index.

  • There's no need to define this task explicitly, it's added automatically as part of the schema element initialisation.

elasticPurge

Used to synchronise purges of schemas with the removal of documents in the associated Elasticsearch index.

  • There's no need to define this task explicitly, it's added automatically as part of the schema element initialisation.

License

MIT