Building queries by Java API but calling ELS by Rest


(Hossein Yeganeh Markid) #1

Hi,

I've found Java API for building queries very convenient in the java application, on the other hand, I want to use Rest Client to call Elastic cluster.
Is this a right approach to use Java API to build my queries and get the query string and call with Rest? Or is that possible?

Thanks in advance


(David Pilato) #2

Are you looking for https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high.html ?


(Hossein Yeganeh Markid) #3

Thanks, this is right API I am looking for but actually, I had seen this one.
My process is like this:
I first create my queries by Elastic test framework and by end of the day I transfer those queries to the real application. Unfortunately, I could not get this high-level rest client from Test-framework.
I want to get this rest client from test framework and code against it and by the end of the day simply copy my code from test classes to the real application without any change.

Test Framework says you can access the TransportClient or NodeClient
I was wondering if there is any way to pass queries built by High-level java rest (SearchSourceBuilder and SearchRequest) to these clients in test framework?

Thanks again


(David Pilato) #4

Ha. So here is what I did (workaround described in the issue):

I hope this helps


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.