hapi fhir elastic search how to configure - elasticsearch

I am using hapi fhir v5.1.0 with jpa server(hapi-fhir-jpa-server-starter). As per the description, this version contains elastic search library for text search.
How can I configure elastic server here?
I see some entries in the properties file and configured the elastic rest url, but nothing works and always get the following error - HSEARCH000222 - the search factory was not initialized.
Could someone please let me know the configuration steps required to activate elastic search inside hapi fhir jpa server?

Related

Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true [JAVA]

We have a java application (spring boot + hibernate search + elastic search).
Application is working fine on elastic search version 6.8
Recently, we have created a new cluster in aws with version 7.10.2 and updated elastic search endpoint in my java application.
After updating the elastic search endpoint I am getting error Can't update put mapping Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true and due to this unable to start the server.
I am not sure where to set include_type_name=true because all the indexes gets created automatically with #Indexed.
Can someone please let us know how can we fix this issue ?
Thanks #yrodiere for your response.
I tried to upgrade below dependencies version but unfortunately not able to fix it.
Previous Version:
compile 'org.hibernate:hibernate-search-orm:5.9.3.Final'
compile 'org.hibernate:hibernate-search-elasticsearch:5.9.3.Final'
compile 'org.hibernate:hibernate-search-elasticsearch-aws:5.9.3.Final'
Updated version :
compile 'org.hibernate:hibernate-search-orm:5.9.3.Final
compile 'org.hibernate.search:hibernate-search-backend-elasticsearch:6.1.1.Final'
compile 'org.hibernate.search:hibernate-search-backend-elasticsearch-aws:6.1.1.Final'
Note: If I downgrade this org.hibernate:hibernate-search-orm:5.9.3.Final then getting CE
am i missing something?
You're probably using Hibernate Search 5.x. In Hibernate Search 5.x, the Elasticsearch integration was experimental and only compatible with Elasticsearch up to version 5.6.
The fact that your application was working fine with Elasticsearch 6.8 was pure luck: Hibernate Search 5.x was never intended to work with Elasticsearch 6+.
To upgrade to a more recent version of Elasticsearch, you must upgrade to Hibernate Search 6.0 (or later). The API is different, but there is a very detailed migration guide, and at least you will get production-ready (non-experimental) Elasticsearch integration (plus tons of improvements).
Note that Hibernate Search 6.x also requires upgrading to Hibernate ORM 5.4; see this compatibility matrix.

How to change elasticsearch version in reactive spring data elastic search api?

spring data elasticsearch uses 7.x client version and my production elasticsearch version is 6.4.2. So I changed the version and got the following exception. How to safely change version in spring data es?
Repopsitory: https://github.com/Yungdi/spring-data-reactive-elasticsearch
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.data.elasticsearch.core.ReactiveElasticsearchTemplate.<init>(ReactiveElasticsearchTemplate.java:108)
The following method did not exist:
org.elasticsearch.action.support.IndicesOptions.strictExpandOpenAndForbidClosedIgnoreThrottled()Lorg/elasticsearch/action/support/IndicesOptions;
The method's class, org.elasticsearch.action.support.IndicesOptions, is available from the following locations:
jar:file:/Users/we/DevEnv/gradle-6.4.1/caches/modules-2/files-2.1/org.elasticsearch/elasticsearch/6.4.2/29a4003b7e28ae8d8896041e2e16caa7c4272ee3/elasticsearch-6.4.2.jar!/org/elasticsearch/action/support/IndicesOptions.class
The class hierarchy was loaded from the following locations:
org.elasticsearch.action.support.IndicesOptions: file:/Users/we/DevEnv/gradle-6.4.1/caches/modules-2/files-2.1/org.elasticsearch/elasticsearch/6.4.2/29a4003b7e28ae8d8896041e2e16caa7c4272ee3/elasticsearch-6.4.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.action.support.IndicesOptions
You can’t use a Elasticsearch 6 cluster with Spring Data Elasticsearch 4 which uses Elasticsearch 7 libraries. The Elasticsearch REST API that is used had breaking changes between version 6 and 7.
You can try to use Spring Data Elasticsearch 3.2.x which targets 6.8; I currently don’t know if there were breaking changes between Elasticsearch 6.4 and 6.8, you’ll have to try it.

spring data elastic search log issue

I am trying to connect to Elastic Search 5.4.2 .
I am using spring-data-elasticsearch 3.0.0.M4.
I get the below exception when i connect to the elastic search instance
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{ZJchkKLgRUGzjUP_cG7z9g}{102.21.31.52}{102.21.31.52}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:348)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:246)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:366)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:408)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:397)
at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.execute(AbstractClient.java:1250)
at org.elasticsearch.client.support.AbstractClient$IndicesAdmin.exists(AbstractClient.java:1272)
I used to get similair error when i was working with lower versions of Elastic Search ( 2.3.3 ) . Mostly it would be related to incompatible version of elastic search and spring data elastic search
I would like to view the logs in order to know the root cause of the error.
I am not able to enable logs for org.elasticsearch package.
If I configure the log4j.xml , I am able to view the spring data logs but elastic search logs are not showing up ? Has anybody faced similar issue ?
I was browsing through the elastic search source code and could not find much logger statements ( esp . in org.elasticsearch.client.transport ) . Do they have minimal log statements ?

ElasticSearch - Index a large file using Java API

We have a requirement wherein we have to use ElasticSearch for performing full text search. We have a Spring based application and for integration with ES we can use either Java API of Elastic Search or Spring Data for ElasticSearch.
The input will be of a file type having size around 5MB.
I went through examples for both ES Java API and SpringData, they do have
tutorials available for inserting a JSON document.
But any help with regards to using File as an input to create documents/index is not available.
I am newbie with Elastic Search, any guidance/help on this will be much appreciated.
EDIT:
I could see that there is a Ingest Attachment Processor plugin available in ES (https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest-attachment.html).
Can anybody point me to a sample CURL request to use this plugin or any Java code to use this plugin
1.You may use Elasticsearch mapper attachments plugin. This plugin uses Apache Tika to ingest almost any well known type of document and make it searchable by Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/plugins/2.3/mapper-attachments.html
2.You can use Apache Tika to extract useful content from file and use elasticsearch Bulk Indexing api to index to ES
Hope that helps

No support of elastic search river with informix

When i try to connect the elastic search jdbc river plugin with postgres or h2 db to get the data into the elastic search engine, it behaves properly.
But in case of informix it always give this kind of error :-
java.sql.SQLException: No suitable driver found for jdbc:informix-sqli:
even after i put the jar file into the plugin/jdbc folder.
can anybody has any idea on that.
The issue was with the Jar, I had all the 6 jars but the thing wat elastic search engine accepts a jar in specific way which means jar should contail Meta-Inf->services->jdbc.sql.Driver, which was not there so explicitly I had mension the driver name in the elastic search configuration. which is
set JAVA_OPTS=%JAVA_OPTS% -Djdbc.drivers=com.informix.jdbc.IfxDriver

Resources