Questions tagged [elasticsearch-java-api]
281 questions
3
votes
4 answers
Elasticsearch Java API do not return fields of hits
I have a problem with the java api for elasticsearch.
When I do a search like this:
MatchQueryBuilder query = QueryBuilders.matchQuery("_type", "booking");
SearchResponse searchResponse =…

John
- 142
- 1
- 11
3
votes
1 answer
Elasticsearch Java Api: set a field as _id
I want to ask if the unique field _id be assigned by certain field within document. I see with Rest, it can achieve by path:
{
"tweet": {
"_id": {
"path": "post_id"
}
}
}
But if I want to do it with java API, is there any way to…

user30851
- 85
- 2
- 5
2
votes
2 answers
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.
SearchRequest searchRequest = new…

cagdasalagoz
- 460
- 1
- 12
- 22
2
votes
1 answer
Query across multiple index in the Elasticsearch version 7.7
In elastic search version 7.7, multiple _types in the index is removed,
Now If we want to query across multiple index, we are doing in the following way.
/index1,index2/_search?q=type:tweet
In 7.7, what is the best way to query from multiple…

Harry
- 3,072
- 6
- 43
- 100
2
votes
2 answers
Elasticsearch Search Scroll API doesn't retrieve all the documents from an index
I would like to retrieve all the documents from Elasticsearch, so I referred to the Search Scroll API.
But my question is, it is not returning all the documents, I have 36 documents in one index, for that it was returning 26 only.
Even when I…

tisispa1
- 203
- 2
- 3
- 16
2
votes
1 answer
Java High Level Rest Client Memory Usage In Range Queries
Following function run range queries on the elastic search, when I use this function repeatedly in a multithread environment, The memory increases drastically until the application crashes.
Does anyone have a solution to this problem?
/**
…

Mehdi Varse
- 271
- 1
- 15
2
votes
0 answers
how to pass json query in Rest high level client in elastic search
In Elastic search for retrieving data i tried to pass a json query through apache http client and elastic search rest high level client, Is there any other flexible way to pass the json query using java API ???Any help will be appreciate Thanks in…

tisispa1
- 203
- 2
- 3
- 16
2
votes
0 answers
How to set script template in SearchRequestBuilder for elasticsearch version 6.6.1
I was able to set the template in es 2.4.1 but this feature is no more present in es 6.6.1. What is an alternative to this?
Template template = new Template(esReqParams.getTemplateName(), esReqParams.getScriptType(),
esReqParams.getLang(),…

Shashi
- 21
- 4
2
votes
1 answer
How to get documents in Elasticsearch based on aggregation output values?
I'd like to use aggregation outputs as an input to filtering for documents in one query.
For example, I'd like to get sales documents in the last 24 hours where sale amount is greater than the average of sale amounts in the last 3 months before the…

ENG_ACK
- 108
- 2
- 7
2
votes
1 answer
Elasticsearch and Spring Compatibility (March 2019)
I am going to start a Spring Data Elasticsearch project but looking on the net, I haven't managed to understand what versions I should use.
I want to use Elasticsearch 5.5.
What versions of Spring Boot and Spring Data Elasticsearch should I…

christouandr7
- 169
- 2
- 12
2
votes
1 answer
The most effective way to check if an Elasticsearch document exists with the given values
I want to check if there are any Elasticsearch documents that exist with specified values. Where is the fastest way to check because I just want to check for existence.
I am looking for implementation in java.

Thinh Nguyen Van
- 113
- 2
- 18
2
votes
1 answer
Elasticsearch: Adding arraylist in QueryBuilders.termsQuery() throws error
I am trying to pass a list of values to QueryBuilders.termsQuery(), but it is throwing the error:
Suppressed: org.elasticsearch.client.ResponseException: method [GET],
host [http://localhost:9200], URI
…

Karthikeyan
- 1,927
- 6
- 44
- 109
2
votes
3 answers
Elasticsearch update the whole `_source` field based on search query
"_source": {
"id": "5b1676493d21784208c36041",
"label": "name",
"properties": {
"name": "patrick"
},
"updatedAt": 1528259039542
}
I want to update this document based on id (not _id)…

Abhijith S
- 526
- 5
- 17
2
votes
0 answers
Unable to connect to ElasticSearch docker container from the transport client in another docker container
I started elasticsearch docker container using:
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.4
then I tried to link another docker container which actually uses the transport…

Krishnkant Swarnkar
- 43
- 6
2
votes
1 answer
How to covert this elastic search functional score query to java API
How to convert the below ES query to Java API? I am using elastic search 2.3.3
GET /schema_name/_search
{
"from": 0,
"size": 200,
"query": {
"function_score": {
"query": {
"match_all": {}
},
"boost": "5",
…

Praveen Kumar
- 1,515
- 1
- 21
- 39