Questions tagged [elasticsearch-java-api]
281 questions
1
vote
0 answers
Deserialize an elastic search hit to Hit
I'm trying to create a Hit 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 following message: "class…

Mansfield
- 14,445
- 18
- 76
- 112
1
vote
1 answer
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 and the only reference being the elasticsearch…

maudderung
- 37
- 5
1
vote
1 answer
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.cloud.es.io
private String hostName =…

Ala Abid
- 2,256
- 23
- 35
1
vote
4 answers
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 [POST], host [***:80], URI…

Aki
- 23
- 6
1
vote
1 answer
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 json source
But why is it resulting to an…

jetpack
- 169
- 1
- 9
1
vote
1 answer
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 back? So far I only get back the "_source" part…

Pompompurin
- 165
- 3
- 14
1
vote
2 answers
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. Previously in elasticsearch version 7, we used…

Dunggeon
- 92
- 1
- 1
- 11
1
vote
0 answers
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 someone please help me to resolve
public void…

khasim
- 11
- 2
1
vote
1 answer
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 searchRequest = new SearchRequest(INDEX_ALIAS);
…

T Ä
- 21
- 4
1
vote
1 answer
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

AJITHKUMAR
- 11
- 3
1
vote
2 answers
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": {
"fields": [
{ "a": {} },
{ "b": {} },
{ "c": {} }
…

igor
- 699
- 1
- 9
- 26
1
vote
1 answer
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.…

jwbroek
- 11
- 4
1
vote
1 answer
How to disable compatibility header in Elasticsearch Java API Client?
I'm trying to config my application to interaction with Elastcisearch server v7.7 using Java API Client v7.16.3. But when I try to index new document, I get the following error:
{"error":"Content-Type header [application/vnd.elasticsearch+json;…

Maksim Konovalov
- 65
- 2
- 8
1
vote
1 answer
How to correctly get the results from MgetResponse object?
In our app, we are synchronizing some of the data to elasticsearch, and some of this data is users' records. The app is grails 5.1 and we are using Elasticsearch Java API Client for elasticsearch integration.
The indexing is working perfectly fine,…

Shurik Agulyansky
- 2,607
- 2
- 34
- 76
1
vote
1 answer
Elasticsearch java client stopped supporting custom query type values, such as enum
Looks like there is a regression\change in Elasticsearch java client, it stopped supporting custom query type values, such as enum:
String query = QueryBuilders.boolQuery().
must(QueryBuilders.termsQuery("status",
…

Doron Levi
- 458
- 4
- 16