mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-30 07:42:35 +00:00
parent
2ea568d2e4
commit
bc7667fdbc
@ -224,11 +224,11 @@ The following code shows as an example how to retrieve all entries that have a _
|
|||||||
SearchHits<Statement> hasVotes() {
|
SearchHits<Statement> hasVotes() {
|
||||||
|
|
||||||
Query query = NativeQuery.builder()
|
Query query = NativeQuery.builder()
|
||||||
.withQuery(co.elastic.clients.elasticsearch._types.query_dsl.Query.of(qb -> qb //
|
.withQuery(co.elastic.clients.elasticsearch._types.query_dsl.Query.of(qb -> qb
|
||||||
.hasChild(hc -> hc
|
.hasChild(hc -> hc
|
||||||
.queryName("vote") //
|
.queryName("vote")
|
||||||
.query(matchAllQueryAsQuery()) //
|
.query(matchAllQueryAsQuery())
|
||||||
.scoreMode(ChildScoreMode.None)//
|
.scoreMode(ChildScoreMode.None)
|
||||||
)))
|
)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ stream.close();
|
|||||||
|
|
||||||
There are no methods in the `SearchOperations` API to access the scroll id, if it should be necessary to access this,
|
There are no methods in the `SearchOperations` API to access the scroll id, if it should be necessary to access this,
|
||||||
the following methods of the `AbstractElasticsearchTemplate` can be used (this is the base implementation for the
|
the following methods of the `AbstractElasticsearchTemplate` can be used (this is the base implementation for the
|
||||||
different `ElasticsearchOperations` implementations:
|
different `ElasticsearchOperations` implementations):
|
||||||
|
|
||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
@ -281,9 +281,8 @@ This works with every implementation of the `Query` interface.
|
|||||||
[[elasticsearch.misc.point-in-time]]
|
[[elasticsearch.misc.point-in-time]]
|
||||||
== Point In Time (PIT) API
|
== Point In Time (PIT) API
|
||||||
|
|
||||||
`ElasticsearchOperations` supports the point in time API of Elasticsearch (see https://www.elastic
|
`ElasticsearchOperations` supports the point in time API of Elasticsearch (see https://www.elastic.co/guide/en/elasticsearch/reference/8.3/point-in-time-api.html).
|
||||||
.co/guide/en/elasticsearch/reference/8.3/point-in-time-api.html). The following code snippet shows how to use this
|
The following code snippet shows how to use this feature with a fictional `Person` class:
|
||||||
feature with a fictional `Person` class:
|
|
||||||
|
|
||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
|
@ -35,6 +35,7 @@ There is support for automatic creation of indices and writing the mappings when
|
|||||||
|
|
||||||
The example shows how to use an injected `ElasticsearchOperations` instance in a Spring REST controller.
|
The example shows how to use an injected `ElasticsearchOperations` instance in a Spring REST controller.
|
||||||
The example assumes that `Person` is a class that is annotated with `@Document`, `@Id` etc (see <<elasticsearch.mapping.meta-model.annotations>>).
|
The example assumes that `Person` is a class that is annotated with `@Document`, `@Id` etc (see <<elasticsearch.mapping.meta-model.annotations>>).
|
||||||
|
|
||||||
.ElasticsearchOperations usage
|
.ElasticsearchOperations usage
|
||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
@ -135,7 +136,7 @@ NOTE: when talking about AND or OR when combining criteria keep in mind, that in
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
Criteria criteria = new Criteria("price").is(42.0);
|
Criteria criteria = new Criteria("price").is(42.0L);
|
||||||
Query query = new CriteriaQuery(criteria);
|
Query query = new CriteriaQuery(criteria);
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
@ -146,7 +147,7 @@ Conditions for the same field can be chained, they will be combined with a logic
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
Criteria criteria = new Criteria("price").greaterThan(42.0).lessThan(34.0L);
|
Criteria criteria = new Criteria("price").greaterThan(42.0L).lessThan(34.0L);
|
||||||
Query query = new CriteriaQuery(criteria);
|
Query query = new CriteriaQuery(criteria);
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
@ -37,7 +37,7 @@ public class Person {
|
|||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
|
|
||||||
ReactiveELasticsearchOperations operations; <.>
|
ReactiveElasticsearchOperations operations;
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user