Questions tagged [elasticsearch-java-api]

281 questions
2
votes
0 answers

How do I get a stack trace from the elastic java client that includes my client call?

For example if I have this code: public class StackTraceTest { @Autowired private Client elasticClient; public void blowUp(){ elasticClient.prepareSearch("index_that_does_not_exist").get(); } } The resulting…
David
  • 14,569
  • 34
  • 78
  • 107
2
votes
1 answer

elastic search combining multiple term and range queries is providing zero results

I am struggling on this for a week now. I need to write an elasticsearch query api in java with following combinations: Price range (0 to n number of ranges) Age range (0 to n number of ranges) Search text Term Filters (can match more than one…
2
votes
2 answers

Elasticsearch multiple condition query using java api

There are multiple documents containing around 100 fields each. I'd like to perform a following search trough elasticsearch Java API 5.x: There are 3 fields I'd like to use for this search i.e. department job name I'd like to search the return…
Zerg
  • 739
  • 4
  • 11
  • 22
2
votes
1 answer

How to add bool query inside a should/must method in java api?

I have a query like this in elasticsearch: "query": { "bool": { "should": [ {"bool": { "must": [ {"term": { "field1": "value1" …
tflave
  • 58
  • 1
  • 2
  • 9
2
votes
1 answer

No way to create index with Settings and Source Java API

The only way to setup Source and Settings using Java API is to use code like this(This is a simple test class with only one @test method): @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest @TestPropertySource(value =…
2
votes
1 answer

Can't connect to ElasticSearch server using Java API and shield

I am trying to connect to my Elasticsearch server using the Java Api and shield. I can execute index, get, delete and search operations on the existing cluster using sense plugin (e.g) and via curl on 9200. I've seen other threads about this but…
2
votes
1 answer

Post Filter Query in Elasticsearch 2.3.3 using Java

I have built a web app on top of elasticsearch (v2.3.3). To filter the query, I am using post filter of elasticsearch. But I came to know that, if I use post filter then the performance benefit of filtering will be lost since I am not using any…
Rose
  • 1,490
  • 5
  • 25
  • 56
2
votes
0 answers

How to map Elasticsearch Java API results to JSON?

How can I convert an Aggregation in the Java API to a JSON result? I've had some success using the toXContent methods to serialize an aggregation to JSON. However, these appear to be internal APIs. Are the toXContent methods a safe way to serialize…
Brandon
  • 6,832
  • 11
  • 38
  • 50
2
votes
1 answer

Updating multiple documents in elasticsearch using Java. I am using Elasticsearch 2.3.2

I want to update some of my indexed data with a particular field using Java Api. I have referred this document https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-docs-update.html and created a java program. My Java program…
Rose
  • 1,490
  • 5
  • 25
  • 56
2
votes
1 answer

Spring data elasticsearch: setting sort value to entity field

Finding nearest stores from elasticsearch, using geo distance sort using spring-data-elastic search. Problem StoreES getting populated with orgCode and storeCode , because they are in _source. How can I populate distance value from search response…
2
votes
1 answer

Elasticsearch must_not not working with filter clause

I am working on medical project, where I have multiple questions along with the topics attached to them. The problem is that the following code works fine but it does not consider the 'must_not' filter, whereas it works fine with 'must' clause. Help…
JDpawar
  • 3,474
  • 2
  • 21
  • 26
2
votes
1 answer

How to use different analyzers in Elasticsearch depending on document to insert?

My mapping has 4 string fields: "name" "info" "language" "genre" and 4 custom analyzers: "english_custom_analyzer" "french_custom_analyzer" "spanish_custom_analyzer" "arabic_custom_analyzer" I want to be able to specify the Analyzer to use when…
danielz
  • 1,767
  • 14
  • 20
2
votes
1 answer

How Groovy script can be invoked using java api for Elasticsearch

Looking for pointers to know how Groovy script can be invoked using java api. test.groovy def value = dynamicValue return value Want to translate following query in Java: GET /test-index/_search { "query": { "match_all": {} }, …
Tushar Khanna
  • 428
  • 6
  • 22
2
votes
1 answer

Special characters within indexed fields

I facing some interesting behavior while searching email addresses with Query String Filter: .filteredQuery( queryStringQuery(String.format("*%s*", query)) .field("firstName").field("lastName").field("email").field("phone"), null ) if…
nKognito
  • 6,297
  • 17
  • 77
  • 138
1
vote
1 answer

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, and i'm able to insert bulk data in…