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

generator-jhipster-elasticsearch-reindexer

v1.2.1

Published

Generates a service that reindexes all database rows for each of your entities

Downloads

512

Readme

generator-jhipster-elasticsearch-reindexer

NPM version Build Status Dependency Status

JHipster module, Generate a service for reindexing all database rows for each of your entities

Introduction

This is a JHipster module, that is meant to be used in a JHipster application.

This module will generate a service using your JHipster entities that allows you to delete and recreate your entity indexes in Elasticsearch, then reinsert all data into the newly created indexes from your main datastore.

This is useful if any changes have been made to the main database outside of the application, like inserting rows using liquibase or migrating data from another database. This can also be used to solve Elasticsearch mapping errors that can be caused by changing a field's type or adding/removing fields.

Prerequisites

This is a JHipster module, so you will need to have JHipster and its related tools already installed:

The generator will run if you haven't created any entities, but only the User entity will be added to the generated service. When creating a new project, it is recommended that you run this generator immediately and allow the post-entity generation hook rerun it automatically as you build your application.

Installation

To install this module:

npm install -g generator-jhipster-elasticsearch-reindexer

To update this module:

npm update -g generator-jhipster-elasticsearch-reindexer

Usage

For monolithic applications or applications from before microservices were introduced, you only need to follow the instructions below once.

For microservices and gateways, you need to follow the directions below for each of your services and gateways. When generating the service for gateways, only reindexing for the User entity will be generated. For microservices, reindexing for every entity except the User entity will be generated.

yo jhipster-elasticsearch-reindexer

This will write all JHipster entities to a service that can be called through your API. This needs to be run any time you add or remove an entity to your project.

If you are using JHipster 2.27.0 and above, a post-entity generation hook will be set that will automatically rerun jhipster-elasticsearch-reindexer. For JHipster 2.26.2 and below, jhipster-elasticsearch-reindexer needs to be rerun manually.

A new admin menu link will be added that will allow you to call the service. You will need to be logged in as an admin user to see it.

If you don't see the link, that probably means you are using an older version of JHipster that does not have support for adding admin menu links from modules. You will need to manually add the link:

<li ui-sref-active="active">
    <a ui-sref="elasticsearch-reindex" data-toggle="collapse" data-target=".navbar-collapse.in">
        <span class="glyphicon glyphicon-exclamation-sign"></span>&#xA0;
        <span translate="global.menu.admin.elasticsearch">Reindex Elasticsearch</span>
    </a>
</li>

Alternatively, you can call the API directly by sending a POST request to api/elasticsearch/index. The request requires valid authentication details for an admin user. Here is an example using the default HTTP session authentication mechanism:

curl -X POST --header "X-CSRF-TOKEN: 00000000-0000-0000-0000-000000000000" --cookie "JSESSIONID=00000000000000000000000000000000;" "http://localhost:8080/api/elasticsearch/index"

This request can also be sent through Swagger.

License

Apache-2.0 © Gerald Humphries