Questions tagged [elasticsearch-java-api]
281 questions
5
votes
2 answers
How to delete all documents from index in an elasticsearch using RestHighLevelClient
I have tried below code it works fine but it uses TransportClient to delete all documents.
DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = DeleteByQueryAction.INSTANCE.newRequestBuilder(transportClient)
…

vishal munjani
- 86
- 2
- 7
5
votes
4 answers
Elasticsearch 6.0.1 NoSuchFieldError: LUCENE_6_0_0
I am using elasticsearch 6.0.1 and on BulkRequest request = new BulkRequest();
I am getting the below error. I have checked online, mostly people said that this happens if I have different versions of lucene jars in the…

Swastik Roy
- 198
- 1
- 13
4
votes
3 answers
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();
However the follow exception was happening
Caused by:…

Bruce
- 1,145
- 1
- 10
- 16
4
votes
2 answers
Elasticsearch RestHighLevelClient missing transitive dependencies
I'm trying to use the RestHighLevelClient via this dependency
org.elasticsearch.client
elasticsearch-rest-high-level-client
6.0.1
…

Fabian
- 3,310
- 3
- 26
- 35
4
votes
1 answer
Elasticsearch Java API 5.4 - How to get the inner hits of a nested query?
I recently started to migrate from Elasticsearch version 2.4 to version 5.4. In version 2.4 I implemented some nested queries including inner hits, using the official Java API, which do not work in version 5.4 anymore.
Can anyone tell me, how to…

The_Dude
- 397
- 1
- 3
- 16
3
votes
2 answers
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 error:
java.lang.NoClassDefFoundError:…

Pompompurin
- 165
- 3
- 14
3
votes
4 answers
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 debugging/tuning/profiling of the query in…

igor
- 699
- 1
- 9
- 26
3
votes
1 answer
Delete child documents without parent in Elasticsearch using Jest
As the title says, I'm trying to delete all the parentless child documents using Jest. If I got things correctly, I need to use DeleteByQuery, and my proposed solution is this:
val allParentlessChildren = QueryBuilders
.boolQuery()
…

makons
- 522
- 1
- 11
- 27
3
votes
0 answers
Distinct High Level Rest Client Elastic Query
How to use High Level Rest Client to find documents by distinct value. Documentation talks about Aggregation framework for finding distinct documents by field. But I could not find any example using High Level Rest Client. How can I get distinct…

java_dude
- 4,038
- 9
- 36
- 61
3
votes
1 answer
Elasticsearch Java High Level Rest Client constructing a boolean query with multiple match values and OR condition
I am trying to construct a query via the java high level rest client that implements taking a list of ids and returning all those documents that match a given id akin to a WHERE clause with an OR operator.
For this reason I have been going with bool…

Justin
- 4,461
- 22
- 87
- 152
3
votes
1 answer
Elasticsearch Java API 7.0 Bulk Insert trying to basic example, throwing errors
Java 1.8, Elasticsearch Low and High Level Rest Clients 7.0.0
I am trying the simple example from the docs found here: Bulk API
BulkRequest bulkRequest = new BulkRequest();
request.add(new IndexRequest("posts").id("1")
…

Justin
- 4,461
- 22
- 87
- 152
3
votes
1 answer
Elasticsearch 6.1.1 Java Api, Missing child aggregation
Doing a long overdue upgrade from ES 2.X to ES 6.1.1. I have changed the parent/child mapping to be the join type so it is valid for 6.X. However we need to use a children aggregation.
The docs say it is available:…

Needs Help
- 275
- 3
- 12
3
votes
1 answer
Bool query with fuzziness in elastic search java client
I am trying to implement the selection of users from a given college and name. Here the name has fuzzy query.
Following is the query in elastic search (v5.1.2) which gives me the desired result. But gives an error in Java
{
"query" : {
…

Tanay Agrawal
- 300
- 1
- 9
3
votes
1 answer
ElasticSearch - Index a large file using Java API
We have a requirement wherein we have to use ElasticSearch for performing full text search. We have a Spring based application and for integration with ES we can use either Java API of Elastic Search or Spring Data for ElasticSearch.
The input will…

SuperCoder
- 819
- 2
- 10
- 26
3
votes
1 answer
How to use the ElasticSearch Java API to build an Aggregation from JSON
My code has an ElasticSearch query and aggregations in JSON format, and wants to call the ElasticSearch Java API.
For the Query portion, I can use WrapperQuery to build the query from the JSON as so:
val query = Json.obj(
"query_string" ->…

Eric Hartford
- 16,464
- 4
- 33
- 50