704 Commits

Author SHA1 Message Date
Christoph Strobl
0060f3d6f3 DATAES-517 - Release version 3.2 M2 (Moore). 3.2.0.M2 2019-03-07 09:42:22 +01:00
Christoph Strobl
76df6c10fc DATAES-517 - Prepare 3.2 M2 (Moore). 2019-03-07 09:41:17 +01:00
Christoph Strobl
b2e2160b45 DATAES-517 - Updated changelog. 2019-03-07 09:41:16 +01:00
Mark Paluch
c3e7056d7b DATAES-530 - Polishing.
Fix generics in ElasticsearchEntityMapper. Extract methods. Move enum conversion handling to simple type handling for symmetric implementation. Swap comparison of nullable types to avoid potential null dereference.

Rename ElasticsearchDefaultTypeMapper to DefaultElasticsearchTypeMapper. Move MapTypeAliasAccessor to DefaultElasticsearchTypeMapper.

Introduce SearchResultMapperAdapter to avoid empty method implementations in anonymous classes. Javadoc, reference docs, formatting.

Original Pull Request: #237
2019-03-06 10:03:02 +01:00
Christoph Strobl
a64af54e26 DATAES-530 - Add converter based EntityMapper.
ElasticsearchEntityMapper provides an alternative to the Jackson based EntityMapper implementation.

Original Pull Request: #237
2019-03-06 10:02:13 +01:00
Mark Paluch
1dc113d57b DATAES-537 - Upgrade to Elasticsearch 6.6.1.
Adapt tests to use new IndicesOptions defaults.

Original Pull Request: #243
2019-03-06 09:29:37 +01:00
Greg Turnquist
e81e38dbb1
DATAES-526 - Introduce Concourse. 2019-02-28 10:41:05 -06:00
Peter Nowak
e0831fa234 DATAES-525 - Fixed issue in scrolling not applying the search query.
The root cause of the deletion problem was the doScroll which did not apply the given query and therefor returned all entries from the index.
The doScroll implementation has been fixed to apply the query and multiple unit tests have been added to ensure that the delete methods delete the desired documents only and leave the rest untouched.
Also added unit tests for the scrolling to test it against real queries (not only matchAll).

Original pull request: #240
2019-02-21 08:27:30 +01:00
Ivan Greene
c77b543fb8 DATAES-523 - Allow specifying version type.
Allow specifying the version type for documents.

Original pull request: #236
2019-02-21 08:24:29 +01:00
Mark Paluch
ae1accd13b DATAES-529 - Updated changelog. 2019-02-13 11:47:59 +01:00
lw
4bef221217 DATAES-500 - queryForList(CriteriaQuery query, Class<T> clazz) can't query all data.
Original pull request: #225
2019-01-24 17:56:19 +01:00
Peter Nowak
a89a44b08f DATAES-531 - Fixed getMapping from ElasticsearchRestTemplate.
The getMapping methods in the ElasticsearchRestTemplate now behave like the methods in the ElasticsearchTemplate and return the mapping for the specified index and type.

Original pull request: #239
2019-01-24 17:24:38 +01:00
Christoph Strobl
69dc36c6c3 DATAES-519 - Add reactive repository support.
Reactive Elasticsearch repository support builds on the core repository support utilizing
operations provided via ReactiveElasticsearchOperations executed by a ReactiveElasticsearchClient.

Spring Data Elasticsearchs reactive repository support uses Project Reactor as its reactive
composition library of choice.

There are 3 main interfaces to be used:

* ReactiveRepository
* ReactiveCrudRepository
* ReactiveSortingRepository

For Java configuration, use the @EnableReactiveElasticsearchRepositories annotation.
The following listing shows how to use Java configuration for a repository:

@Configuration
@EnableReactiveElasticsearchRepositories
public class Config extends AbstractReactiveElasticsearchConfiguration {

  @Override
  public ReactiveElasticsearchClient reactiveElasticsearchClient() {
    return ReactiveRestClients.create(ClientConfiguration.localhost());
  }
}

Using a repository that extends ReactiveSortingRepository makes all CRUD operations available
as well as methods for sorted access to the entities. Working with the repository instance is a matter of dependency
injecting it into a client.

The repository itself allows defining additional methods backed by the inferred proxy.

public interface ReactivePersonRepository extends ReactiveSortingRepository<Person, String> {

  Flux<Person> findByFirstname(String firstname);

  Flux<Person> findByFirstname(Publisher<String> firstname);

  Flux<Person> findByFirstnameOrderByLastname(String firstname);

  Flux<Person> findByFirstname(String firstname, Sort sort);

  Flux<Person> findByFirstname(String firstname, Pageable page);

  Mono<Person> findByFirstnameAndLastname(String firstname, String lastname);

  Mono<Person> findFirstByLastname(String lastname);

  @Query("{ \"bool\" : { \"must\" : { \"term\" : { \"lastname\" : \"?0\" } } } }")
  Flux<Person> findByLastname(String lastname);

  Mono<Long> countByFirstname(String firstname)

  Mono<Boolean> existsByFirstname(String firstname)

  Mono<Long> deleteByFirstname(String firstname)
}

Original Pull Request: #235
2019-01-23 13:54:44 +01:00
Mark Paluch
21a010c65a DATAES-507 - Updated changelog. 2019-01-10 14:15:44 +01:00
Mark Paluch
5ff782ed42 DATAES-506 - Updated changelog. 2019-01-10 12:26:37 +01:00
Mark Paluch
9c4247c47c DATAES-505 - Updated changelog. 2019-01-10 11:01:22 +01:00
Mark Paluch
f3fb779923 DATAES-524 - Update copyright years to 2019. 2019-01-02 12:36:07 +01:00
zzt
e264bd7f84 DATAES-487 - Support for multi search API. 2018-12-21 15:26:14 +00:00
xhaggi
5ff6238399 DATAES-521 - Remove id-type specific repository implementations. 2018-12-19 16:27:16 +01:00
Mark Paluch
3abc3ab13b DATAES-518 - Polishing.
Extract variable.

Original pull request: #233.
2018-12-14 09:43:32 +01:00
Christoph Strobl
a1c139445f DATAES-518 - Use scroll for unpaged find operations in ReactiveElasticsearchTemplate.
We now use scroll instead of a max page size for unpaged queries.

Original pull request: #233.
2018-12-14 09:43:25 +01:00
Christoph Strobl
fae1125e2f DATAES-513 - After release cleanups. 2018-12-11 11:07:53 +01:00
Christoph Strobl
c2f0b5abef DATAES-513 - Prepare next development iteration. 2018-12-11 11:07:52 +01:00
Christoph Strobl
dda137989a DATAES-513 - Release version 3.2 M1 (Moore). 3.2.0.M1 2018-12-11 10:53:53 +01:00
Christoph Strobl
912ed1a8ee DATAES-513 - Prepare 3.2 M1 (Moore). 2018-12-11 10:53:11 +01:00
Christoph Strobl
c5acf161a0 DATAES-513 - Updated changelog. 2018-12-11 10:53:10 +01:00
Christoph Strobl
12b91885bc DATAES-516 - Add profile for release. 2018-12-11 10:49:12 +01:00
Christoph Strobl
a2fad72e86 DATAES-515 - Revert override of Elasticsearch's JarHell for tests.
This reverts commit 25b02f29a741aa659cb8e49ce1d4c85e43c72e84 as the upgrade to Elasticsearch 6.5 made the changes obsolete.
2018-12-11 08:28:03 +01:00
Christoph Strobl
d8f43d3297 DATAES-512 - Polishing.
Update Javadoc and Readme to reflect recent back ports.
2018-12-11 08:27:44 +01:00
Christoph Strobl
a3a46b2e11 DATAES-510 - Add tests for resource clean up.
Original Pull Request: #231
2018-12-11 07:17:10 +01:00
Mark Paluch
b50e60fdd1 DATAES-510 - Polishing.
Wrap Scroll execution with usingWhen and run cleanup through usingWhen callback to clean up scrolls state on success/on error/on cancellation.

Extract isEmpty(SearchHits) check into own method. Improve synchronization in ScrollState to prevent concurrent modification exceptions during read.

Original Pull Request: #231
2018-12-11 07:17:10 +01:00
Christoph Strobl
da9de6bc49 DATAES-510 - Add reactive scroll support.
The ReactiveElasticsearchClient now support scrolling through large result sets issuing subsequent _search/scroll requests while emitting data on the outbound channel. Resources bound via their scrollId get freed on completion of the flux.

Original Pull Request: #231
2018-12-11 07:17:10 +01:00
Christoph Strobl
ce124a2d9e DATAES-512 - Fix request parameters not getting added to the URI as query string parameters.
We now make sure to include request parameters in the constructed URI and add potential request option headers.
2018-12-11 07:17:10 +01:00
Christoph Strobl
1ea73d2fb9 DATAES-504 - Update documentation.
Update documentation to cover newly added configuration options for the ReactiveElasticsearchClient.
Make sure to apply postFilter correctly and set a default limit for unpaged search requests.

Also fix some code format issues.
2018-12-11 07:17:10 +01:00
Mark Paluch
2dcd1cfbad DATAES-504 - Add configuration options for logging and timeouts to ReactiveElasticsearchClient.
We now log HTTP requests and responses with the org.springframework.data.elasticsearch.client.WIRE logger for both, the HighLevelRestClient and our reactive client and associate a logging Id for improved traceability.

Configuration of connection/socket timeouts is now available via the ClientConfiguration.

Along the lines we also aligned entity handling to EntityOperations already common in other modules. EntityOperations centralizes how aspects of entities (versioning, retrieval of index name/index type) are handled.

Original Pull Request: #229
2018-12-11 07:17:10 +01:00
Christoph Strobl
ba890cb7eb DATAES-504 - Add ReactiveElasticsearchOperations & ReactiveElasticsearchTemplate
ReactiveElasticsearchOperations is the gateway to executing high level commands against an Elasticsearch cluster using the ReactiveElasticsearchClient.

The ReactiveElasticsearchTemplate is the default implementation of ReactiveElasticsearchOperations and offers the following set of features.

* Read/Write mapping support for domain types.
* A rich query and criteria api.
* Resource management and Exception translation.

To get started the ReactiveElasticsearchTemplate needs to know about the actual client to work with.
The easiest way of setting up the ReactiveElasticsearchTemplate is via AbstractReactiveElasticsearchConfiguration providing
dedicated configuration method hooks for base package, the initial entity set etc.

@Configuration
public class Config extends AbstractReactiveElasticsearchConfiguration {

    @Bean
    @Override
    public ReactiveElasticsearchClient reactiveElasticsearchClient() {
        // ...
    }
}

NOTE: If applicable set default HttpHeaders via the ClientConfiguration of the ReactiveElasticsearchClient.

TIP: If needed the ReactiveElasticsearchTemplate can be configured with default RefreshPolicy and IndicesOptions that get applied to the related requests by overriding the defaults of refreshPolicy() and indicesOptions().

The ReactiveElasticsearchTemplate lets you save, find and delete your domain objects and map those objects to documents stored in Elasticsearch.

@Document(indexName = "marvel", type = "characters")
public class Person {

    private @Id String id;
    private String name;
    private int age;

    // Getter/Setter omitted...
}

template.save(new Person("Bruce Banner", 42)) // save a new document
    .doOnNext(System.out::println)
    .flatMap(person -> template.findById(person.id, Person.class)) // then go find it
    .doOnNext(System.out::println)
    .flatMap(person -> template.delete(person)) // just to remove remove it again
    .doOnNext(System.out::println)
    .flatMap(id -> template.count(Person.class)) // so we've got nothing at the end
    .doOnNext(System.out::println)
    .subscribe(); // yeah :)

The above outputs the following sequence on the console.

> Person(id=QjWCWWcBXiLAnp77ksfR, name=Bruce Banner, age=42)
> Person(id=QjWCWWcBXiLAnp77ksfR, name=Bruce Banner, age=42)
> QjWCWWcBXiLAnp77ksfR
> 0

Original Pull Request: #229
2018-12-11 07:17:10 +01:00
Christoph Strobl
a39c34058b DATAES-488 - Polishing & Documentation.
Rename VerificationMode -> Verification. Reorder methods in ReactiveElasticsearchClient, add test for DefaultWebClientProvider. Enforce assertions and fix some overall code style issues.
Add client reference documentation section.
2018-12-11 07:17:10 +01:00
Mark Paluch
390d7e8273 DATAES-488 - Polishing.
Convert spaces to tabs for pom.xml. Switch reactive dependencies to optional. Remove unused commonscollections property. Use managed versions for reactor and Spring dependencies.

Introduce WebClientProvider to avoid reinstantiation of WebClient instances. Introduce ClientConfiguration to encapsulate common Elasticsearch client configuration properties. Split ElasticsearchClients into RestClients and ReactiveRestClients to avoid mandatory dependency on WebFlux/Project Reactor. Adapt tests and code referring to WebClient creation.

Extract response body as byte array instead of Flux of DataBuffer to avoid chunking and to parse an entire response.

Encapsulate hostAndPort string used across configuration/HostProvider with InetSocketAddress. Add parser for InetSocketAddress.

Original Pull Request: #226
2018-12-11 07:17:10 +01:00
Christoph Strobl
691a8c57bc DATAES-488 - Add reactive Elasticsearch client support.
Initial implementation of a ReactiveElasticsearchClient using WebClient to connect to cluster nodes.

ReactiveElasticsearchClient client = ElasticsearchClients.createClient()
  .connectedTo("http://localhost:9200", "http://localhost:9201")
  .reactive();
A HostProvider selects active nodes and routes requests.

client.index(request ->

  request.index("spring-data")
    .type("elasticsearch")
    .id(randomUUID().toString())
    .source(singletonMap("feature", "reactive-client"))
    .setRefreshPolicy(IMMEDIATE);
);
This implementation provides the first building block for reactive Template and Repository support to be added subsequently.

Along the lines we upgraded to Elasticsearch 6.5.

Original Pull Request: #226
2018-12-11 07:17:10 +01:00
Mark Paluch
25b02f29a7 DATAES-515 - Override Elasticsearch's JarHell for tests. 2018-12-10 18:39:26 +01:00
Mark Paluch
c5f01807e3 DATAES-514 - Simplify reference documentation setup. 2018-12-10 10:06:41 +01:00
Christoph Strobl
f89c3a0e20 DATAES-508 - Set up travis-ci build. 2018-11-28 13:21:22 +01:00
Mark Paluch
8765485779 DATAES-496 - Updated changelog. 2018-11-27 14:54:09 +01:00
Mark Paluch
11b341884e DATAES-490 - Updated changelog. 2018-11-27 12:36:49 +01:00
Mark Paluch
a373f4f8a5 DATAES-491 - Updated changelog. 2018-11-27 11:27:24 +01:00
tsallase
0469a3c7be DATAES-445 - Updated scroll API example.
Original pull request: #218
2018-11-20 11:50:11 +01:00
xhaggi
89d0633fd5 DATAES-33 - Polishing
* Move @Parent property recognition to ElasticsearchPersistentProperty
* Move type contraints for @Version and @Parent fields to ElasticsearchPersistentProperty to fail faster
* remove unused constant SUPPORTED_ID_TYPES from SimpleElasticsearchPersistentProperty

Original pull request: #208
2018-11-20 11:45:26 +01:00
xhaggi
527f669f76 DATAES-503 - Added missing copy_to property to @Field annotation.
Original pull request: #227
2018-11-20 11:23:05 +01:00
xhaggi
dcf4cbe32a DATAES-492 - Add missing normalizer property to @Field and @InnerField.
Original pull request: #222
2018-11-20 09:21:51 +01:00
Artur Konczak
86c45eff81 DATAES-499 - Fix build - jar hell 2018-11-09 11:46:25 +00:00