287 questions
1
vote
2
answers
303
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<...
1
vote
2
answers
2k
views
Elasticsearch - Migrating from Java High Level Rest Client to New Java API Client of Version 8.x
I am using the new version 8.13 of Elasticsearch for a new search app and trying to imitate the below kind of logic using the new Java API client instead of using Java High Level Rest client which was ...
0
votes
1
answer
54
views
Elasticsearch How to exclude indices when using Java Api Client
Elk-Stack Version: 8.7.1
Java Api Client: 8.13.1
When executing a search I want to search over all indices excluding all indices that start with a dot.
According to the regular Elasticsearch Api you ...
0
votes
1
answer
173
views
Elasticsearch Java Api client single metric aggregation deserializer
I am using elasticsearch-java api client (8.10.3) and facing a small issue and I hope someone has already encountered this issue before.
I am trying to perform a min aggregation on documents that may ...
0
votes
1
answer
393
views
Writing a script score search using elastic search Java API
I have the following query to use with Elasticsearch.
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"...
1
vote
1
answer
146
views
How to create Nested field in index using Elasticsearch Java Client 8
I have an ES index that is created from Java code level when I index a POJO with ElasticsearchClient.
How do I specify that I need certain fields to be type: "nested" in my index?
0
votes
0
answers
161
views
Migrating from ElasticSearch 1.7 to 7.17 using Java Client API - filteredQuery
I'm migrating from ES1.7 to 7.17. Facing some issues with implementing filteredQuery using Java Client API.
For example, in 1.7.5
QueryBuilder queryBuilder = QueryBuilders.filteredQuery(QueryBuilders....
0
votes
1
answer
187
views
how to use more Like this query score to function score in Elasticsearch
how to use "more Like this" query score to function score in Elasticsearch
static FunctionScore mltFunctionScore(String text, Double weight, List<String> fields) {
return ...
0
votes
2
answers
672
views
Using terms in NativeQuery to search for multiple optional matches
The elasticsearch document has "flattened" fields that can contain one or more pairs of "name":"value".
For example, the "flattened" fields "genre" ...
1
vote
1
answer
633
views
Is BulkIngester (replacement of 'Bulk Processor') in elasticsearch java api thread safe?
Use case: I have multiple kafka listeners for various topics. Each topic Listener will run in multiple threads (using spring's 'ConcurrentKafkaListenerContainer'). Listeners will be performing Update/...
0
votes
1
answer
276
views
Saving an elasticsearch query for reuse possible?
Does anyone know if this is possible? The closest thing I've seen is the save query option in Kibana. But I'd like to have this for Java/Spring. My idea is for users to build their own elasticsearch ...
1
vote
1
answer
3k
views
Bulk insert in elasticsearch using elasticsearch-java
I'm trying to bulk insert documents in elasticsearch using java with (elasticsearch-java).
I checked official documentation of elasticsearch-java and found information around bulk indexing in index, ...
0
votes
1
answer
509
views
Elastic-search java - Nested field count and sum sub aggregation
I have following structure in elastic search index
{
"_index" : "hotel",
"_type" : "_doc",
"_id" : "13171",
"...
0
votes
2
answers
2k
views
Update of a record in elastic using elastic 8.7 javaclient
I attempted to add a couple new fields to an existing record in elastic search. The record is being updated, however all previously indexed fields have been cleared.
Is there something am I doing ...
0
votes
1
answer
562
views
Quarkus Native on GraalVM issue with ElasticSearch Java Client jakarta.json.JsonException: Provider org.eclipse.parsson.JsonProviderImpl not found
I'm using Quarkus 2.16.6.Final with ElasticSearch 8.7. I've written a small piece of code to use ES's update_by_query feature.
try (Reader query = new StringReader(/*my json query String*/)) {
var ...
0
votes
1
answer
63
views
Java Elasticsearch - Querying nested element fields with And
I have the following structure in ES (Also dataset for this example)
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful&...
1
vote
1
answer
1k
views
mapping elasticsearch inner hits result to class within java
I don't even know how to word this question properly so here's my best.
This is the result of me getting the innerhits from a nested field called "attributes" I have for an index (after ...
1
vote
1
answer
1k
views
OpenSearch [Elasticsearch] Find documents which exist in text
I'm working with OpenSearch, and I have a large input text that contains several exercise names. I'd like to extract these exercise names from the input text and search for documents that match these ...
1
vote
0
answers
2k
views
Deserialize an elastic search hit to Hit<ObjectNode>
I'm trying to create a Hit<ObjectNode> from a json string returned by Elastic (for unit-testing purposes). When I try to deserialize this using .withJson I get a ClassCastException with the ...
0
votes
2
answers
590
views
Elasticsearch inner hits reponse
This is my query function :
public List<feed> search(String id) throws IOException {
Query nestedQuery = NestedQuery.of(nq ->nq.path("comment").innerHits(InnerHits.of(ih -&...
0
votes
1
answer
442
views
Replacement for SearchTemplateRequest class in java api client
I am migrating a java application from elastic search high level client to java api client. There is a SearchTemplateRequest class in elastic search java high level client. But I couldn't find any ...
0
votes
1
answer
1k
views
Elasticsearch Java Client Jackson Mapper pollutes Spring Jackson Mapper
I'm updating my Spring Boot project to version 3.0.0 of Spring Boot.
One important dependecy is the Spring Data Elastic Repository. I included the starter dependency:
implementation("org....
1
vote
1
answer
2k
views
How do I use point in time with search after in ElasticSearch JAVA API?
I'm trying to test pagination in the latest release (8.5) with point-in-time and search after in the Java API. I don't know exactly how to implement it as the Java API documentation is barely existent ...
0
votes
1
answer
1k
views
How to use elasticsearch search query into springboot
GET products/_search
{
"query": {
"multi_match" : {
"query": "novel",
"fields": [ "description", "name",&...
0
votes
1
answer
2k
views
Which Java ES client should I use with ElasticSearch 7.6 cluster?
I want to use Java API client provided by ElasticSearch but I don't know if it would be compatible with my cluster.
I saw there was ElasticSearch High Level REST client which has been deprecated for ...
0
votes
1
answer
1k
views
Elasticsearch noop update response not deserializable
My scripted update produces the following noop response since the condition was not met:
/my_idx/_update/my_doc_id
{
"_index": "my_idx",
"_type": "_doc",...
1
vote
1
answer
963
views
Connect to Elastic Cloud from the Java Client
I've been trying to connect to my ES instance on the Elastic cloud with no success using the Java client and following the Documentation
In the hostname I put https://myinstance-xx.europe-west1.gcp....
0
votes
2
answers
404
views
Elasticsearch Java - Search with should clause
I have a model for Book saved in elastic search. It has couple of attribute minimumAge and maximumAge, which determines what age the book is recommended for
I have couple of usecases for searching ...
1
vote
1
answer
2k
views
Set timeout in Elastic Java API Client
I am trying to move from Elastic High level rest client to Elastic Java API Client (Low Level Rest Client). I am able to get the response, but i want to set the timeout for my elastic query.
But this ...
2
votes
4
answers
4k
views
Can I use elasticsearch-java with elasticsearch 7.5.2?
I hava tried many version of elasticsearch-java but none of it can work.
So, my elasticsearch version is 7.5.2, and the error resonse is like this:
org.elasticsearch.client.ResponseException: method [...
0
votes
1
answer
623
views
Multimatch query failure
Hi Team I am using elasticsearch after a long time and facing some difficulties with multi_match queries.
Essentially my query need to have an exact match on 2 fields and should do a text search on 4 ...
0
votes
1
answer
2k
views
DeleteRequest example with elastic 8.3.0 java api client
I need examples for DeleteRequest with respect to ES 8.3.0 Java Api client.
I am looking for code reference where I want to delete one particular document by passing index name and the condition to ...
0
votes
1
answer
528
views
ListenerExecutionFailedException Nullpointer when trying to index kafka payload through new ElasticSearch Java API Client
I'm migrating from the HLRC to the new client, things were smooth but for some reason I cannot index a specific class/document. Here is my client implementation and index request:
@Configuration
...
0
votes
1
answer
1k
views
Daterange + top_hits aggregation (as subaggregation) with Elasticsearch Java API Client 7.17.x
I've been at this for a day and I don't quite understand how I do it! This is the query I want to "recreate" with the new Java API Client (using Spring Boot)
{
"aggs": {
&...
1
vote
1
answer
3k
views
New elasticsearch-java API `CreateIndexRequest` using `.withJson` causes `co.elastic.clients.util.MissingRequiredPropertyException`
I am having a hard time on using the new elasticsearch-java api client.
I am migrating from HLRC to the new elasticsearch java api.
When I create an index, I used CreateIndexRequest and load it with ...
4
votes
3
answers
5k
views
Elasticsearch POST /my-index/_count error 406 Not Acceptable
I'm using elasticsearch-java-client 7.17.4 to make my a count request to AWS Elasticsearch server like this follow code
elasticsearchClient.count(s -> s
.index("my-index")
).count();
...
3
votes
3
answers
10k
views
Creating a TermQuery with a List by using Elasticsearch Java API Client
I am trying to convert some Java High Level REST Client code to new Elasticsearch Java API Client.
I want to convert this query which retrieves the contents if the id is equal to 10 or 20.
...
3
votes
2
answers
15k
views
ClassNotFoundException: com.fasterxml.jackson.core.util.JacksonFeature in Spring boot, upgrading from Elasticsearch HLRC to Java API Client
I wanted to swap out the deprecated High Level Rest Client with the new Java API Client from Elasticsearch. Problem is, I'm not sure if my dependencies are configured correctly! I'm running into this ...
2
votes
1
answer
6k
views
returning the entire Elasticsearch response (as SearchResponse) from Java API Client in Spring Boot REST API
I'm learning about Elasticsearch and the Java Client API (currently just following the documentation), it works well but I'm wondering if it's possible to return the whole search response from a query ...
2
votes
3
answers
4k
views
How can I create Bulk CRUD Operations request in Elasticsearch version 8 using JAVA APIs?
We wanted to create IndexRequest, DeleteRequest, UpdateRequest and BulkRequest in Elasticsearch version 8 using JAVA APIs. But I don't see any java documentation in elasticsearch v8 official website. ...
1
vote
0
answers
568
views
Simple aggregation is getting failed in javaelasticsearch 8.0+ client
I have got a simple method that performs simple terms aggregation using elastic search8.0
I am able to do it using RestHighLevelClient but with ElasticsearchClient I am getting empty buckets.
can ...
0
votes
2
answers
5k
views
elasticsearch java.lang.NoSuchMethodError: org.apache.http.client.utils.URLEncodedUtils.formatSegments
I'm trying this basic elasticsearch example from there guide to use java client API in a spring boot project.
but it gives me the following error when running:
java.lang.NoSuchMethodError: org.apache....
1
vote
1
answer
411
views
Elastic 8.1.1 - Cannot instantiate FunctionScore, build() protected
I am trying to migrate some elastic functionalty from elasticsearch 6.5.4 -> 8.1.1, specifically a functionScoreQuery:
private SearchRequest buildRequest(String query) {
SearchRequest ...
1
vote
1
answer
1k
views
highlight in elasticsearch query? how to highlight two fields?
my search field is one ,but I need to highlight two fields in a document? how can I achieve this
Ex:
my search query is match:{"file":"hello"}
I want to highlight email field also
1
vote
1
answer
2k
views
highlight of elasticsearch in java?
i need to highlight the match word in a document,
in java client.
i don't know where to fix highlight object
this is my java code for search:
HighlightBuilder highlightBuilder = new ...
0
votes
1
answer
175
views
Java API not querying as I would expect
I'm using the newer 8.1 Java API for Elastic in Kotlin, and getting behavior that isn't what I would expect, nor what I get when using the manual REST API. Here's my code:
val boolQuery = BoolQuery....
0
votes
1
answer
2k
views
Ranged query with Java Client API for Elasticseach 8.0+
I found some topics about ranged queries and Elasticsearch but these use the deprecated High Level REST Client interface. I also found a discussion on the elasticseach page which uses the new ...
1
vote
2
answers
851
views
How to "Explicitly order highlighted fields" using ElasticSearch Java API client v7.16?
I want to explicitly order highlighted fields using the Elasticsearch Java API Client 7.16.
In other words I want to build the following request
GET /_search
{
"highlight": {
"...
3
votes
6
answers
6k
views
How to get the json representation of the ElasticSearch query/request that was built with Java API Client (7.16)?
A new Java API Client was released in the 7.16 version of ES and the Java Rest Client was deprecated. There was the ability to convert a query to JSON in the deprecated client. It was convenient for ...
1
vote
1
answer
411
views
How to use {dynamic_type} in in a dynamic template in the new ElasticSeach Java API Client
I have a dynamic template in which I use the special value {dynamic_type}, as I need it to work on every type that doesn't match any of my other templates. (https://www.elastic.co/guide/en/...