I am migrating an application to the latest spring-boot version (using maven spring-boot-dependencies with version 2.5.4). I have an interface called Customer and I have two implementations of that interface (BusinessCustomer, PrivateCustomer) The three classes are annotated like that: For querying the index “customers” I used to have code like: But this is not working anymore. I get an error
Tag: elasticsearch
Does MultiSearchRequest request returns response in the same sequence as it was added in SearchRequest?
I am using MultiSearchRequest to execute multiple search queries using SearchRequest as below: My question is when i call: MultiSearchResponse response = client.msearch(request, RequestOptions.DEFAULT); can i expect to get response in the same sequence as the requests were added OR they will be at random. Currently i am assuming it will be returning response in sequence as they were added
How to return all documents where a field does not exist, but if it exists return documents with value “tag1”
I am facing a problem in building an elasticsearch query in Java. I want to search all the documents where either a field X is not present OR if it is present, return all those documents where the value inside field X is “tag1” Currently, I have written this query in Java: The SQL query for this would be something
Difference between elasticsearch ReIndex task REST API implementation and Java rest high level client
Hi I’m trying to use elastic search reindex api via rest high level client and am comparing two ways of doing it. Rest API: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-task-api [![Rest API Documentation screenshot][1]][1] Running reindex asynchronously – If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of
How to search with optional data and list data in ElasticsearchRepository?
I am using spring-data-elasticsearch and I have a class as follows, Above is persisted to elasticsearch. And I have the following method to find data in it. But the challenge I am facing is I have 2 Optional fields and 1 List field that need to check if contains the status. I tried multiple ways in ElasticsearchRepository but none of
direct logging on elasticsearch vs using logstash and filebeat
I’m using a Spring Boot back-end to provide some restful API and need to log all of my request-response logs into ElasticSearch. Which of the following two methods has better performance? Using Spring Boot ResponseBodyAdvice to log every request and response that is sent to the client directly to ElasticSearch. Log every request and response into a log file and
Spring Data Elasticsearch Class Cast exception on Named Query
I’m getting the following exception when trying to use a named query with Spring Data Elasticsearch. The query I’m trying to make is: If I do not use the @Query annotation and instead let Spring derive the query from the method name like so: It works as expected. However, the PlayerNumber field is a @MultiField that supports the the field
Name or Service not Known when calling service via spring boot in Openshift Container Platform (a cloud-based Kubernetes container platform)
I have an application which consists of a backend (spring boot) and a search engine (elasticsearch). After I deployed it into OCP, Initially I tested the connection between the two using the command “curl” to elasticsearch service (https://service-name.namespace.svc.cluster.local:9200) from backend pod and it worked. Here’s the picture: However, when I try to access elasticsearch from within the deployed backend application,
Spring Elasticsearch sorting by field with whitespace
I need to sort my documents by some fields, one sorting – one field. But every time I’m getting wrong sorting. In document I have uid and title. Uid in document looks like ‘AAA-100’ and title could be just a text with spaces. And when i’m trying to sort by those fields i’m getting wrong order. For example when i’m
ElasticSearch painless determine that field was array in source document
Elasticsearch contains document like With mapping and If i do and I get org.elasticsearch.index.fielddata.ScriptDocValues$Strings type for both fields. How can i determine source field type? (I need get string length if field is simple string or size of array if field is array) Answer The correct painless expression to use is: