Jan Bednar created CAMEL-14237:
----------------------------------

             Summary: camel-elasticsearch-rest: Index, BulkIndex, Bulk 
operations not working in Spring Boot
                 Key: CAMEL-14237
                 URL: https://issues.apache.org/jira/browse/CAMEL-14237
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.0.0, 3.0.0.RC3, 3.0.0.RC2, 3.0.0.RC1
            Reporter: Jan Bednar


All write operations fails with 
{noformat}
org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 
1: type is missing;{noformat}
The issue here is we have upgraded dependencies to 7.3.2 to support elastic 7 
(indexType was removed in Elastic 7), but somehow starter is packaged with 
6.8.4 dependencies, so the request validation fails. Not sure how this could 
happen, all poms seems to be fine

Using plain camel-elasticsearch-rest dependency instead of starter does not 
help, because elasticsearch.client versions are somewhere overriden (probably 
by camel-spring-boot-dependencies)

The only way I was able to make this component work was by overriding elastic 
dependency versions in my pom ( 
[https://github.com/bedlaj/camel3-elastic-sb-workaround/blob/master/pom.xml#L91]
 ):

 
{noformat}
<dependency>
   <groupId>org.elasticsearch</groupId>
   <artifactId>elasticsearch</artifactId>
   <version>7.3.2</version>
 </dependency>
 <dependency>
   <groupId>org.elasticsearch.client</groupId>
   <artifactId>elasticsearch-rest-high-level-client</artifactId>
   <version>7.3.2</version>
 </dependency>
 <dependency>
   <groupId>org.elasticsearch.client</groupId>
   <artifactId>elasticsearch-rest-client</artifactId>
   <version>7.3.2</version>
 </dependency>{noformat}
Reproducer project can be found here 
[https://github.com/bedlaj/camel3-elastic-sb-workaround/blob/master/pom.xml#L91]

Remove workaround in pom.xml on lines 75-88 and 91-105 to see this bug in 
action.

*mvn dependency:tree* on current camel master shows this:
{code:java}
maven-dependency-plugin:3.1.1:tree (default-cli) @ 
camel-elasticsearch-rest-starter ---                              
                                                       
org.apache.camel.springboot:camel-elasticsearch-rest-starter:jar:3.1.0-SNAPSHOT 
                                                                                
                                                   
+- org.springframework.boot:spring-boot-starter:jar:2.2.1.RELEASE:compile       
                                                                                
                                                   
|  +- 
org.springframework.boot:spring-boot-starter-logging:jar:2.2.1.RELEASE:compile  
                                                                                
                                             
|  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile                       
                                                                                
                                                   
|  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile                       
                                                                                
                                                   
|  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile             
                                                                                
                                                   
|  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile               
                                                                                
                                                   
|  |  \- org.slf4j:jul-to-slf4j:jar:1.7.29:compile                              
                                                                                
                                                   
|  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile               
                                                                                
                                                   
|  +- org.springframework:spring-core:jar:5.2.1.RELEASE:compile                 
                                                                                
                                                   
|  |  \- org.springframework:spring-jcl:jar:5.2.1.RELEASE:compile               
                                                                                
                                                   
|  \- org.yaml:snakeyaml:jar:1.25:compile                                       
                                                                                
                                                   
+- org.apache.camel:camel-elasticsearch-rest:jar:3.1.0-SNAPSHOT:compile         
                                                                                
                                                   
|  +- org.apache.camel:camel-support:jar:3.1.0-SNAPSHOT:compile                 
                                                                                
                                                   
|  |  +- org.apache.camel:camel-api:jar:3.1.0-SNAPSHOT:compile                  
                                                                                
                                                   
|  |  +- org.apache.camel:camel-management-api:jar:3.1.0-SNAPSHOT:compile       
                                                                                
                                                   
|  |  +- org.apache.camel:camel-util:jar:3.1.0-SNAPSHOT:compile                 
                                                                                
                                                   
|  |  +- org.apache.camel:camel-util-json:jar:3.1.0-SNAPSHOT:compile            
                                                                                
                                                   
|  |  \- org.slf4j:slf4j-api:jar:1.7.29:compile                                 
                                                                                
                                                   
|  +- 
org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:6.8.4:compile 
                                                                                
                                             
|  |  +- org.elasticsearch:elasticsearch:jar:6.8.4:compile                      
                                                                                
                                                   
|  |  |  +- org.elasticsearch:elasticsearch-core:jar:6.8.4:compile              
                                                                                
                                                   
|  |  |  +- org.elasticsearch:elasticsearch-secure-sm:jar:6.8.4:compile         
                                                                                
                                                   
|  |  |  +- org.elasticsearch:elasticsearch-x-content:jar:6.8.4:compile         
                                                                                
                                                   
|  |  |  |  +- 
com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.10.1:compile    
                                                                                
                                    
|  |  |  |  +- 
com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.1:compile     
                                                                                
                                    
|  |  |  |  \- 
com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.10.1:compile     
                                                                                
                                    
|  |  |  +- org.apache.lucene:lucene-core:jar:7.7.2:compile                     
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-analyzers-common:jar:7.7.2:compile         
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-backward-codecs:jar:7.7.2:compile          
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-grouping:jar:7.7.2:compile                 
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-highlighter:jar:7.7.2:compile              
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-join:jar:7.7.2:compile                     
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-memory:jar:7.7.2:compile                   
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-misc:jar:7.7.2:compile                     
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-queries:jar:7.7.2:compile                  
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-queryparser:jar:7.7.2:compile              
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-sandbox:jar:7.7.2:compile                  
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-spatial:jar:7.7.2:compile                  
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-spatial-extras:jar:7.7.2:compile           
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-spatial3d:jar:7.7.2:compile                
                                                                                
                                                   
|  |  |  +- org.apache.lucene:lucene-suggest:jar:7.7.2:compile                  
                                                                                
                                                   
|  |  |  +- org.elasticsearch:elasticsearch-cli:jar:6.8.4:compile               
                                                                                
                                                   
|  |  |  |  \- net.sf.jopt-simple:jopt-simple:jar:5.0.2:compile                 
                                                                                
                                                   
|  |  |  +- com.carrotsearch:hppc:jar:0.7.1:compile                             
                                                                                
                                                   
|  |  |  +- joda-time:joda-time:jar:2.10.5:compile                              
                                                                                
                                                   
|  |  |  +- com.tdunning:t-digest:jar:3.2:compile                               
                                                                                
                                                   
|  |  |  +- org.hdrhistogram:HdrHistogram:jar:2.1.9:compile                     
                                                                                
                                                   
|  |  |  \- org.elasticsearch:jna:jar:4.5.1:compile                             
                                                                                
                                                   
|  |  +- org.elasticsearch.client:elasticsearch-rest-client:jar:6.8.4:compile   
                                                                                
                                                   
|  |  |  +- org.apache.httpcomponents:httpasyncclient:jar:4.1.4:compile         
                                                                                
                                                   
|  |  |  \- org.apache.httpcomponents:httpcore-nio:jar:4.4.12:compile           
                                                                                
                                                   
|  |  +- org.elasticsearch.plugin:parent-join-client:jar:6.8.4:compile          
                                                                                
                                                   
|  |  +- org.elasticsearch.plugin:aggs-matrix-stats-client:jar:6.8.4:compile    
                                                                                
                                                   
|  |  +- org.elasticsearch.plugin:rank-eval-client:jar:6.8.4:compile            
                                                                                
                                                   
|  |  \- org.elasticsearch.plugin:lang-mustache-client:jar:6.8.4:compile        
                                                                                
                                                   
|  |     \- com.github.spullara.mustache.java:compiler:jar:0.9.3:compile        
                                                                                
                                                   
|  +- 
org.elasticsearch.client:elasticsearch-rest-client-sniffer:jar:7.3.2:compile    
                                                                                
                                             
|  |  +- org.apache.httpcomponents:httpclient:jar:4.5.10:compile                
                                                                                
                                                   
|  |  +- org.apache.httpcomponents:httpcore:jar:4.4.12:compile                  
                                                                                
                                                   
|  |  +- commons-codec:commons-codec:jar:1.13:compile                           
                                                                                
                                                   
|  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.10.1:compile             
                                                                                
                                                   
|  \- com.fasterxml.jackson.core:jackson-databind:jar:2.10.1:compile            
                                                                                
                                                   
|     \- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.1:compile      
                                                                                
                                                   
...                                                                             
                                                                         
{code}
Currently this component cannot be used with ES6, because we have removed 
indexType option in CAMEL-13767. Also cannot be used with ES7, because old 
client validates indexType, which was removed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to