【发布时间】:2021-11-09 09:29:00
【问题描述】:
我在使用 MassIndexer 时遇到问题,这让我很头疼,首先我觉得我的英语有点糟糕,我经常使用翻译器
我正在使用 Java 8、Hibernate search 6 和 Elasticsearch 7,我遇到了一个非常奇怪的问题,当我运行 massIndexer 时它没有索引任何东西,其他一切都很好,创建、修改或删除时的自动索引数据库实体,搜索完成没有问题,但执行 massIndexer 时,结果始终是“HSEARCH000028:大规模索引完成。索引 0 个实体”并且它没有更多结束,没有一个唯一的错误消息或异常,什么都没有,第一步清理弹性搜索索引做得很好,但是当索引总是以“HSEARCH000028:海量索引完成。索引0个实体”结束时
我已经尝试获取更多日志、调试、测试 entityManager 以防它在那一侧失败,我已经更改了库的版本,我已经搜索了互联网,但我没有看到同样的问题和案例看起来很像来自非常旧的版本,还有更多我什至不记得的东西,但它无法正常工作。
所以我非常需要帮助,因为我被困在那个点上,我不知道还能做什么。
这是我在 AplicationConfig 中的配置:
jpaProperties.put("hibernate.search.enabled","true");
jpaProperties.put("hibernate.search.automatic_indexing.strategy","session");
jpaProperties.put("hibernate.search.backend.hosts", "127.0.0.1:9200");
jpaProperties.put("hibernate.search.backend.protocol", "http");
jpaProperties.put("hibernate.search.backend.username", "");
jpaProperties.put("hibernate.search.backend.password", "");
jpaProperties.put("hibernate.search.backend.type", "elasticsearch");
jpaProperties.put("hibernate.search.automatic_indexing.synchronization.strategy", "sync");
jpaProperties.put("hibernate.search.schema_management.strategy", "drop-and-create");
jpaProperties.put("hibernate.search.automatic_indexing.enable_dirty_check","true");
并且运行massIndexer的代码和hibernate search 6文档一样,方便测试:
SearchSession searchSession = Search.session( entityManager );
searchSession.massIndexer().startAndWait();
如果您需要任何其他信息,请告诉我,并提前非常感谢您
-----已编辑-----
非常感谢yrodiere的回复
我试过了:
- entityManager.createQuery("select count (o) from java.lang.Object o") .getResultList ()
- Search.mapping (entityManager.getEntityManagerFactory ())。 AllIndexedEntities ();
在这两种情况下,他们都给了我预期的数据,所以在那方面一切都是正确的
我把massIndexer的日志放在下面,因为超过了字符限制,我无法把应用程序开头的那些放在下面:
[14/09/21 11:52:12.089][DEBUG][MassIndexerImpl.<init>] Targets for mass indexing: [MassIndexingIndexedTypeGroup[commonSuperType=es.indra.hn.ispob.modelo.entity.DatPatientDateEntity, includedSubTypes=[es.indra.hn.ispob.modelo.entity.DatPatientDateEntity]], MassIndexingIndexedTypeGroup[commonSuperType=es.indra.hn.ispob.modelo.entity.DatPatientStringEntity, includedSubTypes=[es.indra.hn.ispob.modelo.entity.DatPatientStringEntity]], MassIndexingIndexedTypeGroup[commonSuperType=es.indra.hn.ispob.modelo.entity.DatPatientTokenEntity, includedSubTypes=[es.indra.hn.ispob.modelo.entity.DatPatientTokenEntity]], MassIndexingIndexedTypeGroup[commonSuperType=es.indra.hn.ispob.modelo.entity.PersonaEntity, includedSubTypes=[es.indra.hn.ispob.modelo.entity.PersonaEntity]]]
[14/09/21 11:52:12.107][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientdateentity-write/_refresh', query parameters {} and 0 objects in payload in 10ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.121][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientstringentity-write/_refresh', query parameters {} and 0 objects in payload in 10ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.125][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientdateentity-write/_delete_by_query', query parameters {conflicts=proceed} and 1 objects in payload in 11ms. Response had status 200 'OK'. Request body: <{"query":{"match_all":{}}}>. Response body: <{"took":1,"timed_out":false,"total":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}>
[14/09/21 11:52:12.136][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatienttokenentity-write/_refresh', query parameters {} and 0 objects in payload in 12ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.143][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientstringentity-write/_delete_by_query', query parameters {conflicts=proceed} and 1 objects in payload in 13ms. Response had status 200 'OK'. Request body: <{"query":{"match_all":{}}}>. Response body: <{"took":1,"timed_out":false,"total":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}>
[14/09/21 11:52:12.145][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/personaentity-write/_refresh', query parameters {} and 0 objects in payload in 11ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.155][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatienttokenentity-write/_delete_by_query', query parameters {conflicts=proceed} and 1 objects in payload in 10ms. Response had status 200 'OK'. Request body: <{"query":{"match_all":{}}}>. Response body: <{"took":0,"timed_out":false,"total":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}>
[14/09/21 11:52:12.162][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/personaentity-write/_delete_by_query', query parameters {conflicts=proceed} and 1 objects in payload in 9ms. Response had status 200 'OK'. Request body: <{"query":{"match_all":{}}}>. Response body: <{"took":2,"timed_out":false,"total":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}>
[14/09/21 11:52:12.178][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientdateentity-write/_forcemerge', query parameters {} and 0 objects in payload in 7ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.190][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientstringentity-write/_forcemerge', query parameters {} and 0 objects in payload in 10ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.196][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatienttokenentity-write/_forcemerge', query parameters {} and 0 objects in payload in 6ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.205][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/personaentity-write/_forcemerge', query parameters {} and 0 objects in payload in 8ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.206][TRACE][IdentifierConsumerDocumentProducer.<init>] created
[14/09/21 11:52:12.208][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.211][TRACE][IdentifierProducer.<init>] created
[14/09/21 11:52:12.212][TRACE][BatchTransactionalContext.wrapInTransaction] TransactionFactory does not require a TransactionManager: don't wrap in a JTA transaction
[14/09/21 11:52:12.212][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.211][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.214][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.214][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.221][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.224][TRACE][IdentifierProducer.run] started
[14/09/21 11:52:12.291][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.292][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.294][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.301][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.307][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.297][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.316][DEBUG][BatchIndexingWorkspace.runWithFailureHandler] Indexing for DatPatientDateEntity is done
[14/09/21 11:52:12.317][TRACE][IdentifierConsumerDocumentProducer.<init>] created
[14/09/21 11:52:12.330][TRACE][IdentifierProducer.<init>] created
[14/09/21 11:52:12.331][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.331][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.331][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.331][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.331][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.331][TRACE][BatchTransactionalContext.wrapInTransaction] TransactionFactory does not require a TransactionManager: don't wrap in a JTA transaction
[14/09/21 11:52:12.335][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.342][TRACE][IdentifierProducer.run] started
[14/09/21 11:52:12.405][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.407][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.408][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.410][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.410][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.410][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.413][DEBUG][BatchIndexingWorkspace.runWithFailureHandler] Indexing for DatPatientStringEntity is done
[14/09/21 11:52:12.414][TRACE][IdentifierConsumerDocumentProducer.<init>] created
[14/09/21 11:52:12.421][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.422][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.426][TRACE][IdentifierProducer.<init>] created
[14/09/21 11:52:12.428][TRACE][BatchTransactionalContext.wrapInTransaction] TransactionFactory does not require a TransactionManager: don't wrap in a JTA transaction
[14/09/21 11:52:12.429][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.430][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.435][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.436][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.438][TRACE][IdentifierProducer.run] started
[14/09/21 11:52:12.498][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.498][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.502][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.504][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.505][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.505][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.506][DEBUG][BatchIndexingWorkspace.runWithFailureHandler] Indexing for DatPatientTokenEntity is done
[14/09/21 11:52:12.507][TRACE][IdentifierConsumerDocumentProducer.<init>] created
[14/09/21 11:52:12.510][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.511][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.514][TRACE][IdentifierProducer.<init>] created
[14/09/21 11:52:12.515][TRACE][BatchTransactionalContext.wrapInTransaction] TransactionFactory does not require a TransactionManager: don't wrap in a JTA transaction
[14/09/21 11:52:12.515][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.519][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.520][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.523][TRACE][IdentifierProducer.run] started
[14/09/21 11:52:12.523][TRACE][IdentifierConsumerDocumentProducer.run] started
[14/09/21 11:52:12.581][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.581][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.584][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.581][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.585][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.581][TRACE][IdentifierConsumerDocumentProducer.run] finished
[14/09/21 11:52:12.588][DEBUG][BatchIndexingWorkspace.runWithFailureHandler] Indexing for PersonaEntity is done
[14/09/21 11:52:12.615][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientdateentity-write/_flush', query parameters {} and 0 objects in payload in 11ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.626][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientstringentity-write/_flush', query parameters {} and 0 objects in payload in 11ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.641][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatienttokenentity-write/_flush', query parameters {} and 0 objects in payload in 14ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.656][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/personaentity-write/_flush', query parameters {} and 0 objects in payload in 10ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.676][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientdateentity-write/_refresh', query parameters {} and 0 objects in payload in 11ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.688][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatientstringentity-write/_refresh', query parameters {} and 0 objects in payload in 12ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.711][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/datpatienttokenentity-write/_refresh', query parameters {} and 0 objects in payload in 17ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.729][TRACE][ElasticsearchClientImpl.log] HSEARCH400093: Executed Elasticsearch HTTP POST request to 'http://127.0.0.1:9200' with path '/personaentity-write/_refresh', query parameters {} and 0 objects in payload in 8ms. Response had status 200 'OK'. Request body: <>. Response body: <{"_shards":{"total":2,"successful":1,"failed":0}}>
[14/09/21 11:52:12.729][INFO ][LoggingMassIndexingMonitor.indexingCompleted] HSEARCH000028: Mass indexing complete. Indexed 0 entities.
根据日志,索引实体识别良好,分别是:DatPatientDateEntity、DatPatientStringEntity、DatPatientTokenEntity和PersonaEntity
我使用的版本是: 休眠搜索 6.0.6 休眠 ORM 5.4.4.Final
【问题讨论】:
标签: java hibernate elasticsearch indexing hibernate-search