Questions tagged [spring-data-elasticsearch]
Spring Data makes it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services as well as provide improved support for relational database technologies.
1,289
questions
0
votes
2
answers
34
views
Elasticsearch QueryBuilder: find by ids and prefix
I'm implementing custom repository based on Spring Data Elasticsearch:
@Document(indexName = "product", createIndex = false)
public class ProductDocument implements Serializable {
@Id
...
0
votes
0
answers
22
views
Unable to create indexes or communicate with AWS Open search using spring boot application
I want to integrate AWS elastic search (Open search) with my spring boot application. For this, I followed the tutorial at https://medium.com/@prasanth_rajendran/how-to-integrate-spring-boot-...
0
votes
1
answer
20
views
spring-boot-starter-data-elasticsearch gives results for @Query in 2.4.4 version & no results for the same query & data point in 2.5.13 version
I have my Query this way :-
@Repository
@Timed
public interface EmployeeRepository extends ElasticsearchRepository <Employee, String> {
@Query("{"terms":{"id": ?...
0
votes
0
answers
24
views
Register and Update Elasticsearch Percolate Query using Reactive Spring Data Elasticsearch
I'm trying to create an endpoint that registers and updates an Elasticsearch percolate query.
The code in Elasticsearch java API documentation is as follow:
// create an index with a percolator field ...
0
votes
1
answer
13
views
how to ignore null field when deserializing in spring data elasticsearch
I have saved two objects.
@Document(indexName = "test_index", createIndex = false)
public class ZTest {
@Id
private String id;
private String testOne;
@Transient
...
0
votes
1
answer
18
views
index is being created or updated when entity is set with createIndex=false
Spring data elastic search version is 4.1.15 I have two issues.
index is being created or updated when entity is set with createIndex=false
JsonIgnore field is being saved.
Here is my first testing.
...
0
votes
0
answers
16
views
spring-data-elasticsearch 4.2.6
Have you ever encountered this situation? When using spring-data-elasticsearch 4.2.6, the index field property of creating an index is not the same as the entity class field property? As shown below!
0
votes
1
answer
24
views
Elasticsearch : how to search multiple words in a copy_to field?
I am currently learning Elasticsearch and stuck on the issue described below:
On an existing index (I don't know if it matter) I added this new mapping:
PUT user-index
{
"mappings": {
&...
0
votes
1
answer
99
views
spring boot 2.6.8 and elasticsearch 7.17.2 compatibility
I want to customize springboot 2.6.8 elasticsearch dependency to elasticsearch 7.17.2, is this ok?
Based on springboot dependency versions, 2.6.8 is mapped to elasticsearch version 7.15.2.
But I want ...
0
votes
1
answer
28
views
Spring Data Elasticsearch - How to get mapping for a field
Wondering how to do this in java using spring data elasticsearch library.
GET /my-index-000001/_mapping/field/user
0
votes
0
answers
20
views
Elasticsearch - set the _id inside the java response object
I'm looking for a way to get _id set inside my java response object just like Spring Data does when we use @Id annotation.
I'm using ES 7.17.3
Elasticsearch JSON response:
{
"_scroll_id": ...
0
votes
1
answer
15
views
Using MultiField annotation in an entity class for use with elastic search
I am currently using Spring boot 2.7.0 and spring data elastic search 4.4.0 with ELK 7.17.4. Having an issue in using MultiField annotation.
Getting a MappingException, but the annotation has been ...
0
votes
0
answers
21
views
BeanInstantiationException Failed to instantiate org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository
Getting issue after upgrading Spring boot version from 2.4.2 to 2.6.8 .When starting the server getting below error:
14:38:38,461 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 92) ...
0
votes
0
answers
28
views
How to Get elasticsearch data aggregations using Swagger API calls (spring data elasticsearch)
I am new to spring data elasticsearch. I want to be able to return data aggregations (simply, the count of values that are 'true' for a field) from elasticsearch to the front-end.
Here is my ...
0
votes
0
answers
24
views
how to only use alias in spring data elastic search
Spring data search version is 4.1.15. I define entity class as below and use ElasticsearchRepository for CRUD and ElasticsearchOperations for customized query.
@Document(indexName = "my_index&...
0
votes
1
answer
79
views
Spring upgrade issue - ClassNotFoundException
I have upgraded my spring boot from 2.2.6.RELEASE to 2.7.0.
After the upgrade , i am getting ClassNotFoundException when i start the application.
I tried with 2.6.6 but result is same.
My pom file ...
0
votes
0
answers
27
views
How to make index name as any variable Name of our model same class
I am using sprinf data jpa elastic search, in which i need whenever i fetch data by like findById(), or something everytime the Name of the elasticSearch index can be diffrent...
@Document(indexName =...
0
votes
2
answers
34
views
How to return one field from a query (Spring Data Elasticsearch)
I am writing a query; in Kibana it's easy
GET populationstreamassignment/_search
{
"query": {
"match": {
"healthyChildrenIndicator": true
}
},
&...
0
votes
1
answer
33
views
Can Spring Data Elastic Search connect to a proxy REST service that connects to Elastic Search?
My company has Elastic Search behind the REST endpoints /search and /count, but it hides the cluster nodes from access.
I could call those REST endpoints through Native DSL queries, but I don't want ...
0
votes
1
answer
20
views
Add Size in Elastic NativeSearchQuery
final QueryBuilder contentTagQuery = QueryBuilders.boolQuery()
.filter( QueryBuilders.termQuery("tenantId" , "en"));
SearchHits<Content> searchHits =
...
0
votes
1
answer
30
views
Elastic Search Result in List of POJO
Currently, I am mapping the elastic search hit to a POJO and then reiterating it to save in a list.
List<Content> contentList = new ArrayList<>();
final BoolQueryBuilder qb = ...
0
votes
1
answer
19
views
How to flush data to Spring data elastic search
I run this testcase
Envelope envelope = new Envelope();
envelope.setId("1");
Envelope saved = envelopeRepository.save(envelope);
assertThat(saved.getId()).isEqualTo("1");
saved ...
0
votes
0
answers
94
views
NoSuchMethodError: org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity.getInstanceCreatorMetadata()'
I am using "spring-data-elasticsearch" but
getting the below error while using findById(id) in spring data elasticsearch.
Note: save/update is working fine.
Can someone please help me here?
...
0
votes
1
answer
19
views
How to implement index rollover properties/condition in ES using spring-data-elasticsearch
How can I add the following property values in elastic search when using spring-data-elasticsearch?
The maximum size or age at which you want to roll over to a new index.
The point at which the index ...
0
votes
2
answers
43
views
Elasticsearch Java - use Search Template to query
I have below code working fine in my java service.
Query searchQuery = new StringQuery(
"{\"bool\":{\"must\":[{\"match\":{\"id\":\"" + id + &...
0
votes
1
answer
47
views
Spring Data Elasticsearch: ClassCastException thrown in existsBy* repository method
I've got this trivial index in ES:
{
"dynamic": "strict",
"properties": {
"_class": {
"type": "text",
"fields":...
1
vote
1
answer
29
views
ElasticSearch Spring - disable date_detection only for a set of fields and not the entire index using @Mapping annotation
I'm trying to disable date_detection on a set of fields in an index. Below is the mapping
{
"my-index" : {
"mappings" : {
"properties" : {
"...
1
vote
1
answer
49
views
ElasticSearch automatically converting field type inside Java Map from String to date when saving
I have the following index mapping - a field called customFields contains other fields such as firstName, lastName, etc.
{
"customFields": {
"properties": {
"...
0
votes
0
answers
21
views
Using @Query to access a data object?
I have a Spring Elastic Repository function that has way too many parameters (11 parameters).
I want to be able to access members of class objects to reduce the parameter count. Is there a way to ...
0
votes
1
answer
22
views
How to access request attributes in SpEL for spring data elastic search
I need to use dynamic index per request in spring data elastic search. I got it working by creating a @RequestScope object
how does singleton bean handle dynamic index
I am trying to get it working ...
0
votes
1
answer
26
views
how does singleton bean handle dynamic index
I am working spring data elastic search. Based on different header in the request, I create @RequestScope object IndexConfig to hold different set of indexes. It seems to be working. But I don't ...
0
votes
1
answer
110
views
Compatibility (as Spring boot Maven dependencies) between Elasticsearch 7.17, spring data elasticsearch and elasticsearch-rest-high-level-client
I have an Spring Boot + Elasticsearch application that had the now deprecated High Level Rest Client. I am trying to migrate the existing queries/methods to the new Java API Client but want to keep ...
0
votes
2
answers
51
views
How does Spring Data decide what is returned by FindBy
How does Spring Data's findBy decide which database record to return if there are multiple matches?
I realised if I have more than one entry in my Elastic Search database with the same attribute code (...
0
votes
0
answers
96
views
Spring Data ElasticSearch override version
i upgraded springboot version 2.6.6 from 2.5.7.
and i'm using spring-data-elasticsearch.
i want to keep spring-data-elasticsearch version ( i'm using 4.2.7 )
so, i configured this.
implementation(&...
0
votes
0
answers
77
views
How to make Spring Data Elasticsearch serialize aggregation results
I want to obtain aggregations from ES using Spring Data Elasticsearch with the following code (in a service):
public SearchHits<Document> getDocumentMetadata() {
Query query = new ...
1
vote
2
answers
129
views
how to run testcontainer with dynamic port for spring data elasticsearch
My test case uses @SpringBootTest annotations to bring up the context and has Autowired some repository. Testcontainer is started in @BeforeAll() method. The problem is RestClientConfig is being ...
0
votes
1
answer
94
views
Elasticsearch stops working after I run the springboot Java program and elasticsearch transport node is not loading in my Java Program
Elasticsearch version 8.1.3
Java version 1.8
Im trying to connect elasticsearch with Java springboot program. My Elasticsearch works fine until I run the Java program, also my java program works fine ...
0
votes
1
answer
36
views
Get Count for Generic Repository
I am trying to get the total number (count) for a given field from an index using a generic repository. The index mapping is huge and I do not wish to have an equivalent mapping on the Springboot side....
0
votes
1
answer
47
views
Spring Data Elasticsearch query all indices
I can GET http://localhost:9200/_all/_search?q=query to search all indices for the query string. However, I can't find a way to do this using spring data elasticsearch's ElasticsearchOperations or ...
0
votes
1
answer
38
views
how to migrate search query from ElasticsearchRepository to ElasticsearchOperations
My repository class uses the queries by using the standard method name findByxxx. It also has custom query using NativeSearchQueryBuilder.
Since search() methods have been removed from ...
0
votes
1
answer
134
views
How to connect to multiple servers in spring data elasticsearch
I use the following configuration for elastic and I want to use multiple addresses instead of one
@Configuration
@EnableElasticsearchRepositories
class Config {
@Bean
fun client(): ...
0
votes
0
answers
26
views
How to package a spring boot project using spring data elastcsearch with maven without skiping test?
I'm putting together a spring boot project that uses spring boot elasticsearch, the plan is to package the project on my local machine as a .jar file, send it to my offsite server, and run it.
On my ...
0
votes
0
answers
45
views
Creating List of Aggregations
I am totally new to the Spring Data ES world and trying to create a list of aggregations in that each element has a "term" and another "aggs" like below and then add the main ...
0
votes
0
answers
85
views
how to migrate from spring-date-elasticsearch 3.x to 4.3
Application is on old spring-date-elasticsearch 3.x. It uses ElasticsearchRepository with TransportClient. The goal is to migrate to latest spring-date-elasticsearch 4.3. I am thinking to use ...
0
votes
1
answer
226
views
spring-data-elasticsearch latest version throws NullPointer exception with Elasticsearch 8.1 version
Planning to use elasticsearch 8.1 version and use 'org.springframework.boot:spring-boot-starter-data-elasticsearch' in
our project.
Repository.save() throws following exception.
java.lang....
0
votes
1
answer
112
views
Creating Nested Query in Spring Data Elasticsearch
I am totally new to Spring Data Elasticsearch and trying to build a query like the one below;
Any help would be greatly appreciated.
{
"query":{
"bool":{
"...
0
votes
1
answer
86
views
Spring Native with RestHighLevelClient not connecting to AWS OpenSearch
I have a Lambda configured and running on "Custom runtime on Amazon Linux 2". GraalVM is the runtime used for our application.
When Lambda tries to make a connection with OpenSearch, it ...
0
votes
1
answer
54
views
How to create query for elasticsearch by spring-data-elasticsearch
I hope to execute a query and the condition is that one field not existing. I only know that we are able to use exists() to retrieve the data when the field existing. But I cannot find any api for no ...
0
votes
0
answers
26
views
Does spring native support spring-boot-starter-data-elasticsearch dependency?
I am trying to build a spring native image with ‘spring-boot-starter-data-elasticsearch’ dependency which uses RestHighLevelClient to interact with elasticsearch.
It turns out I always receive ‘...
1
vote
1
answer
259
views
can I use old spring-data-elasticsearch to connect to new elasticsearch?
Currently we are on spring-data-elasticsearch 3.2.6 + elasticsearch 6.8.
We are moving to new elasticsearch 7.x. Do I have to update spring-data-elasticsearch to 4.x? We only use ...