如何使用API​​(jhipster)创建的弹性搜索实体 [英] How to Elasticsearch entities not created using API (jhipster)

查看:136
本文介绍了如何使用API​​(jhipster)创建的弹性搜索实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Jhipster与Postgresql,我创建了一个实体客户。当我使用Angular UI或POST到API向此实体添加数据时,我可以使用UI上的搜索表单搜索此数据。



但是,当我直接在数据库中插入数据时,即使在重新启动应用程序之后,数据仍然无法搜索。搜索仍然可以(仅)通过UI添加的数据。



我是弹性搜索的新手,不知道在后端插入数据并使其可用于弹性搜索之间缺少一个步骤。请帮助,如果有需要配置的东西,以便在应用程序启动期间弹性搜索从数据库中提取数据。



我的应用程序-dev.yml摘录spring数据弹性搜索:


  data:
elasticsearch:
cluster-name:
cluster-nodes:
属性:
路径:
日志:target / elasticsearch / log
数据:target / elasticsearch / data


解决方案

Elasticsearch本质上是一个数据存储区,这就是JHipster与普通JPA存储库同时保存到搜索库的原因。没有内置的重建索引功能,用于在API之外进行更改。



我已经编写了一个模块,将生成一个重新索引所有实体的服务。 p>

https://github.com/ geraldhumphries / generator-jhipster-elasticsearch-reindexer


Using Jhipster with Postgresql, I have created an entity "Customer". When I add data to this entity using the Angular UI or POST to the API, I can search this data using the search form on the UI.

However, when I insert data in the database directly, the data is not searchable even after application restart. The search would still work (only) on the data added through the UI.

I am new to elasticsearch and do not know if there is a missing step between inserting data on the backend and making it available to elasticsearch. Please help, if there is something I need to configure to let elasticsearch pick up data from the database during application startup.

My application-dev.yml excerpt for spring data elasticsearch:

    data:
    elasticsearch:
        cluster-name:
        cluster-nodes:
        properties:
            path:
              logs: target/elasticsearch/log
              data: target/elasticsearch/data

解决方案

Elasticsearch is essentially a datastore which is why JHipster saves to the search repositories at the same time as the regular JPA repositories. There is no built-in reindexing functionality for making changes to it outside of the API.

I have written a module that will generate a service for reindexing all entities.

https://github.com/geraldhumphries/generator-jhipster-elasticsearch-reindexer

这篇关于如何使用API​​(jhipster)创建的弹性搜索实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆