Git Product home page Git Product logo

opensearch-nodejs-dive-in's Introduction

Hands-on material for session on how to start working with OpenSearch® and NodeJS

Additional written guidance can be also found in articles how to write search queries with OpenSearch and NodeJS and how to use aggregations with OpenSearch and NodeJS.

Prerequisites

To run examples from this repository you'll need:

  1. An OpenSearch cluster. You can set it up manually or you can use a fully managed service, such as Aiven for OpenSearch.
  2. NodeJS and npm. If you don’t have NodeJS or npm installed, follow these instructions.
  3. Curiosity and patience 😉

Running locally

  1. Clone the repository and install the dependencies:

    npm install
    
  2. Copy .env.example, rename to .env and there the service_uri of your OpenSearch cluster.

  3. Download full_format_recipes from Kaggle. Unzip and copy the JSON file to the root folder of this project.

  4. Install run-func to run javascript methods from command line with more convenience:

    npm i -g run-func
    

You're all set! Retrieve the list of available indices by running in your terminal

run-func search getIndices

How to use

  1. Make sure that you have full_format_recipes.json at the root level of the repository and run command to inject data:

    run-func index injectData
    

Wait till the data is indexed. Can take 15-20 seconds.

  1. Check search.js and aggregate.js for examples you can run. Every method contains a terminal command sample that you can try.
run-func search match title "garlic onion cake"
run-func aggregate field rating

Structure of this repository

index.js - working with index, injecting data

search.js - examples of different types of search queries

aggregate.js - examples of different types of aggregation queries

config.js and helpers.js contain operations required to connect to the cluster and log responses.

License

This work is licensed under the Apache License, Version 2.0. Full license text is available in the LICENSE file and at http://www.apache.org/licenses/LICENSE-2.0.txt

opensearch-nodejs-dive-in's People

Contributors

anelook avatar edgarbjorntvedt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.