1,520 questions
0
votes
1
answer
43
views
Spring data elasticsearch how to print the elasticsearch JSON representation of the query
Using SpringBoot data elasticsearch
Need to print the Elasticsearch JSON representation of the query
Creating a org.springframework.data.elasticsearch.core.query.CriteriaQuery that is passed to
org....
1
vote
1
answer
35
views
ElasticsearchRepository result is greater than 10000 Documents
I have a SpringBoot application in which I query an Elasticsearch cluster using an Elasticsearch repository. This is working fine at first.
I have the following method in my repository, among others:
...
0
votes
0
answers
48
views
Spring Data Elasticsearch all shards failed exception
I faced a problem connected with Elasticsearch while implementing full text search. When I try to find documents in index I face this problem
2025-08-27T09:15:59.544+03:00 ERROR 19622 --- [Muse] [nio-...
0
votes
0
answers
39
views
Spring Data elasticsearch , using match_phrase with Criteria
I have a Spring Boot 3.3.x application that uses Spring Data Elasticsearch to query a single Elasticsearch index.
The query is built dynamically using the Criteria API. Now, I need to add a new ...
0
votes
1
answer
61
views
Concurrent writes to Elasticsearch Index using plainless script
This is a followup question to (Is there a way to have field level audit in elastic search?)
Step 1:
#push a sample doc
PUT my_index/_doc/1
{
"created_at": "2025-02-24T13:00:00Z",...
0
votes
1
answer
82
views
How should I implement script sort in spring-data-elasticsearch 5.3.x
How should I implement script sort in spring-data-elasticsearch 5.3.x
NativeQueryBuilder nativeQueryBuilder= new NativeQueryBuilder();
nativeQueryBuilder.withQuery(query);
nativeQueryBuilder.withSort(...
0
votes
1
answer
87
views
Is there a way to have field level audit in elastic search?
I have an index with say 10 fields. These fields may get modified from time to time. Is there a way to add any field level timestamp, which can store the timestamp when it was last updated and also ...
0
votes
1
answer
71
views
Spring data elastic search custom conversions doesn't work
Custom @ReadingConverter isn't being triggered but when I was initially implementing this code it worked normally.
Configuration class:
@Configuration
public class ElasticsearchConfig {
@Bean
...
0
votes
1
answer
42
views
How to combine must and should for the same field in filter Elasticsearch Spring Boot?
I'm using Elasticsearch filters and I would like to apply a must condition for selected regions (e.g., Occitanie and Île-de-France). Additionally, I want to ensure that profiles with the region "...
0
votes
0
answers
23
views
How to Implement Complex Queries (Vector Queries) in Spring Data Elasticsearch
The following code will throw an exception: [es/search] failed: [parsing_exception] unknown query [query].
@Query(value = """
{
"query": {
"script_score": {...
-1
votes
1
answer
111
views
How to submit task in ElasticSearch Java API Client?
Now, RestHighLevelClient is deprecated.
So i want rewrite code with ElasticSearch Java Api Client in my spring project.
Most of the functions are being modified properly, but I have not found an ...
0
votes
0
answers
25
views
Highlighting not working when using Java elasticsearch api
When I use the following query using CURL I successfully get highlights:
{
"query": {
"query_string": {
"query": "Angular"
}
},
"...
0
votes
0
answers
71
views
How to search elasticsearch using spring-boot-starter-data-elasticsearch?
I want to use the following elastic search query in Java to search through all my documents in my index.
{
"query": {
"query_string": {
"query": "my ...
0
votes
0
answers
44
views
threw an unhandled Exception: java.lang.NoSuchFieldError: INDEX_CONTENT_TYPE
logger.info("Started Pushing to Elastic Search"); postTestRunDataRepository.saveAll(allTestCasesWithDetails); logger.info("Finished Pushing to Elastic Search&...
1
vote
4
answers
750
views
Elastic Search query upgrade for RangeQuery builder
I am upgrading the elasticsearch version from 8.14.3 to 8.15.3 and there are some issues with this query-
return new RangeQuery.Builder() .field(fieldName) .gte(JsonData.of(dateToday)) .build() ....
0
votes
2
answers
119
views
Issues connecting Spring Boot application to new ELK server after migration
I had an ELK server that I needed to shut down and replace with a new one. I had a Java Spring Boot project that was connected to the original ELK server. After moving to the new server, all the ...
0
votes
1
answer
146
views
Converting blocking code to reactive code when I'm constrained by a blocking library
I have a custom Kafka library that for business reasons I'm forced to use. My use case is to read each record from Kafka and save to a repository. The entry to my repository is a callback I write that ...
0
votes
1
answer
65
views
How to implement CompositeAggregationSource with springboot 3.2.10 and elasticsearch 8.12.1
We have implemented below code using springboot 3.1.0 and elastic search 8.10.4
CompositeAggregationSource compositeAggregationSource = CompositeAggregationSource
.of(ca -> ca.terms(...
0
votes
1
answer
62
views
Spring: Case insensitive search in Elasticsearch
I use spring 2.2.4.RELEASE and spring-data-elasticsearch 3.2.4.RELEASE
My elastic version is 7.10. I already have lot of index and data in it.
I just notice after once year that the search is not ...
0
votes
1
answer
168
views
post_filter after applying top_hits aggregation not working in elastic search
Expectation:
I need all users which are not successful in their last attempt.
Actual/My Approach:
I applied aggregation by userId and top_hits with size of 1 document which is sorted in descending ...
0
votes
0
answers
344
views
Spring Data Elasticsearch throws error when Elasticsearch service is not started
Setting @Document(indexName = "person", createIndex = true) without starting the Elasticsearch service on the machine, the Spring Boot project fails to start and reports the following error:
...
0
votes
1
answer
236
views
Elasticsearch Nested Aggregations with Spring data elasticsearch 5.2
Help Needed: Perform a Nested Aggregation with Spring Data Elasticsearch 5.2.6 and Elasticsearch-rest-client 8.10
I'm working on a project using Elasticsearch with Spring Data Elasticsearch 5.2.6, and ...
0
votes
1
answer
190
views
Spring data Elasticsearch @query with projection/sourcefilter
I am using this documentation: https://docs.spring.io/spring-data/elasticsearch/reference/elasticsearch/repositories/elasticsearch-repository-queries.html
I have a query like this:
interface ...
1
vote
0
answers
77
views
Data type for Elser Sparse Vector Embeddings in Spring Data
I'm generating sparse vector embeddings using elser model, i want to implement search using spring data based application, what datatype should i use for it.
Will the following code work?
@Field(...
-1
votes
1
answer
373
views
Spring Data OpenSearch Unable to Convert Value of @Timestamp to Java Instant
Hi I have field in my opensearch index of @timestamp which looks like this JSON in the document: “@timestamp”: “2024-06-03T20:31:06.40402165Z”,. I tried to retrive the value with the following field ...
0
votes
1
answer
143
views
How do we put the value of k in the knnquery in using elastic search client?
Hi I'm trying to implement knn in elasticsearch, using maven java, but k is not being accepted in the querybuilder using elasticsearch client.
Query knnQuery = QueryBuilders.knn(m -> m
.queryVector(...
1
vote
2
answers
299
views
Specify Elasticsearch Ingest Pipeline in Spring Data Elasticsearch
I am using the Elasticsearch's 8.x Java API client for indexing documents to Elasticsearch. While indexing, I'm specifying an ingest pipeline to be executed during data ingestion.
public Mono<...
0
votes
1
answer
74
views
ReactiveElasticsearchClient query composite aggregation not return all result
I use ReactiveElasticsearchClient to query composite aggregation but not return all result.
I mean I add all docCount value in return message manually, the result is not same as the document total ...
1
vote
1
answer
71
views
Elasticsearch saving date without a year 02/29 problem
I've defined in elasticsearch a field of type date in the format "MM-dd" which works fine except for the date 02-29.
I understand that elastic does use a year when saving (even though it ...
0
votes
1
answer
274
views
How to retrieve stored fields using spring-data-opensearch with _source disabled?
I have an index template like below
{
"index_patterns": [
"request_response-*"
],
"template": {
"settings": {
"number_of_shards": ...
0
votes
0
answers
94
views
How can I filter by `user.login` with Spring Data Elasticsearch and Spring Boot 3.2.5?
I’m trying to upgrade my 21-Points Health JHipster project from v7.9.4 to v8.4.0. The 7.9.4 version uses Elasticsearch Java 7 and the newer version uses Elasticsearch Java 8. I’m struggling to ...
0
votes
1
answer
213
views
Spring Boot Elasticsearch Pagination And Sorting won't sort 'text' type fields in ElasticSearch
In Spring Boot Elasticsearch Repository, I am using the PaginationAndSorting Spring capability (Pagination), which works great for fields that are 'date', but causes an error when I try to sort by a '...
2
votes
2
answers
505
views
Error integrating with OpenSearch when using spring-boot-starter-data-elasticsearch
I have a test project with the following configuration:
spring boot 2.7.18
spring-boot-starter-data-elasticsearch
opensearch 2.6.0
The connection to OpenSearch is configured like this:
@...
0
votes
1
answer
1k
views
spring-data-elasticsearch elasticsearch opensearch spring boot upgrade
I am in process to upgrade sprint boot from 2.7.16 to to 3.2.4
As part of it I upgraded spring-data-elasticsearch, elasticsearch as below
spring-data-elasticsearch from 4.3.3 to 5.1.4,
elasticsearch ...
0
votes
0
answers
115
views
Spring boot [elasticsearch] cluster -x_content_parse_exception- Unexpected character (‘\’ (code 92)): was expecting double-quote
I am using elastic version 8+ with spring boot elasticsearch 5.2.0 dependency. I want to query my index with Odata $filter. I have configured my parser for Odata and it's generating below query json ...
-1
votes
1
answer
48
views
Use Multiple analyzer in elastic search.(Autocomplete and phonetic)
The analysis algorithm is performing well on autocomplete with fuzzy matching but the fuzzy matching is not soo good so i wanted to add phonetic analyzer to same firstname index. i ran through many ...
0
votes
2
answers
64
views
How I can wait until all item were consumed
My task is simple, I need to query elasticsearch rolling index with reactive way.
As the @Document didn't support index name with Spring EL, like @Document(index = "indexName-#(new Date().format(...
0
votes
1
answer
92
views
The query results obtained using elasticsearchOperation differ from those obtained using curl
I am currently attempting to query certain indexes using spring-data-elasticsearch's elasticSearchOperations, employing the following query:
val index = IndexCoordinates.of("test-*-en&...
0
votes
1
answer
55
views
SearchHitsSupport returns hits instead of aggregated data
I am using spring-data-elasticsearch and do some aggregations, below is how I am building a query:
NativeSearchQueryBuilder nativeSearchQueryBuilder = new
NativeSearchQueryBuilder()
....
0
votes
2
answers
213
views
spring data Elasticsearch reactive approach to update by query
Unable to find the appropriate approach to update by query (reactive) in sring-data-elasticsearch:3.1.1.
Earlier versions had something UpdateBy which took a query, but it seems to be deprecated in ...
0
votes
1
answer
57
views
Spring Data Elasticsearch findBy delay
Looks like there is a delay between saving an entity and possibility to use findBy repository methods.
This is my code. Entity which is saved has @Id on sessionId field. The webSocketRepository.save() ...
0
votes
1
answer
154
views
Elastic search conditional field sorting: Cannot cast from [java.util.ArrayList] to [double]
Is it possible to sort elasticsearch documents conditionally? The condition is quite clear, it is visible in my script. When somefield value is present I want to sort by some collection of fields, ...
0
votes
0
answers
101
views
basic_time Exception with Spring-Data-elasticsearch:4.4.18
Hello dear community,
I have migrated from Spring-data-elasticsearch:3.x to 4.4.18 and since then I get this error:
Caused by: java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed ...
0
votes
1
answer
600
views
Compatibility Mode with hlrc in spring-data-elasticsearch
I am currently working on making our hlrc, which we have configured with spring-data-elasticsearch: 4.4.18, compatible with our new ES8 cluster. I have found a migration guide for this here, but it is ...
0
votes
0
answers
119
views
Searchhits Aggregationcontainer doesn't contain method anymore
I currently have the problem of having updated from an older spring-data-elasticsearch version to version 4.4.18. Unfortunately, I am still new to elastic search and am now wondering how I can solve ...
1
vote
1
answer
396
views
Spring Data Elasticsearch + Repository Upsert Query Method
I am working on replacing quite a lot of RestHighLevelClient code with Spring Data Elasticsearch.
Wherever possible, I'm relying on the low-code approach provide by the Repository query methods. This ...
0
votes
0
answers
201
views
Elasticsearch[7.7]: Few updated document is not returned when query for it immediately but after 10-15 mins delay
In our application, we are updating more than one document at a time for a index_x. When queried for updated documents, it does not return updated data for few document, immediately. e.g. If I am ...
-1
votes
1
answer
337
views
Turn on and off the Spring Data Elasticsearch for SpringBoot application
What I am trying to achieve:
Turn on and off the Spring Data Elasticsearch for a SpringBoot application.
What did I try:
I am using this code:
@Configuration
public class MyElasticConfiguration ...
1
vote
1
answer
234
views
Spring data elasticsearch repository.count() returns "Current token (VALUE_NUMBER_INT) not of boolean type"
I'm in the process of upgrading a fairly old app from spring boot 2.0.2 to the latest one.
An interim goal was to update to the latest version 2 (2.7.18)
So this is probably a dependency version ...
0
votes
0
answers
75
views
Stale read in Elasticsearch using Spring Data
In my test case below, a Car is deleted.
Although the car is deleted, the test fails.
According to the test, the car still exists.
When I debug through the code, the test succeeds.
This got me think ...