This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://maven.apache.org/xsd/maven-4.0.0.xsd with 2 occurrences migrated to: https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200). # Ignored These URLs were intentionally ignored. * http://jakarta.apache.org/log4j/ with 1 occurrences * http://maven.apache.org/POM/4.0.0 with 4 occurrences * http://www.w3.org/2001/XMLSchema-instance with 2 occurrences
spring-batch-elasticsearch
ItemReader and ItemWriter implementations for Elasticsearch
To index documents
Create a class and define the index name and type
@Document(indexName="some_index", type="some_type")
public class SomeClass {
// field(s) with getter(s) and setter(s)
}
Create an item processor
public class SampleItemProcess implements ItemProcessor<Object, IndexQuery> {
@Override
public IndexQuery process(Object item) throws Exception {
SomeClass someClass = new SomeClass();
// populate someClass from item (Object)
IndexQueryBuilder builder = new IndexQueryBuilder();
builder.withObject(someClass);
// use other methods on builder as required
return builder.build();
}
}
Configuration for reader/writer
@Configuration
public class ReaderWriterConfig {
@Bean
public ElasticsearchItemReader<SomeInputClass> elasticsearchItemReader() {
return new ElasticsearchItemReader<>(elasticsearchOperations(), query(), SomeInputClass.class);
}
@Bean
public ElasticsearchItemWriter elasticsearchItemWriter() {
return new ElasticsearchItemWriter(elasticsearchOperations());
}
@Bean
public SearchQuery query() {
NativeSearchQueryBuilder builder = new NativeSearchQueryBuilder();
// create query as required using the methods on the builder object
return builder.build();
}
@Bean
public ElasticsearchOperations elasticsearchOperations() {
// configure and return elastic search template
}
}
NOTE
The Pageable object from the Query object will be used for paged requests. Setting the page and pageSize fields (inherited from AbstractPaginatedDataItemReader) will have no effect.