Analyze API available through Java?


(Erick Lee) #1

Hi,

Is there a version of the analyze api available to the Java client? I
looked around and didn't find it.

I'd like to search for documents that start with a phrase. SpanFirst looks
like it lets me search for terms at the start, so I'd like to run the
phrase through the analyzer for the field.

Thanks!

--


(Jörg Prante) #2

Hi Erick,

have a look at the integration tests
in org.elasticsearch.test.integration.indices.analyze, then you find an
example

AnalyzeResponse analyzeResponse = client.admin().indices().prepareAnalyze(
"test", "this is a test").execute().actionGet();
Cheers,

Jörg

On Monday, November 5, 2012 8:45:34 PM UTC+1, Erick Lee wrote:

Hi,

Is there a version of the analyze api available to the Java client? I
looked around and didn't find it.

I'd like to search for documents that start with a phrase. SpanFirst
looks like it lets me search for terms at the start, so I'd like to run the
phrase through the analyzer for the field.

Thanks!

--


(Ivan Brusic) #3

I recreate the AnalysisModule locally and call it directly, avoiding the
network hop to ElasticSearch. It all depends on how many calls you make to
ES.

When in doubt with the Java API, look for the Rest*Action Java class (in
your case RestAnalyzeAction), or the tests as Jörg pointed out.

--
Ivan

On Mon, Nov 5, 2012 at 12:05 PM, Jörg Prante joergprante@gmail.com wrote:

Hi Erick,

have a look at the integration tests
in org.elasticsearch.test.integration.indices.analyze, then you find an
example

AnalyzeResponse analyzeResponse = client.admin().indices().prepareAnalyze(
"test", "this is a test").execute().actionGet();
Cheers,

Jörg

On Monday, November 5, 2012 8:45:34 PM UTC+1, Erick Lee wrote:

Hi,

Is there a version of the analyze api available to the Java client? I
looked around and didn't find it.

I'd like to search for documents that start with a phrase. SpanFirst
looks like it lets me search for terms at the start, so I'd like to run the
phrase through the analyzer for the field.

Thanks!

--

--


(Erick Lee) #4

Thanks, that is what I was looking for.

On Monday, November 5, 2012 12:05:26 PM UTC-8, Jörg Prante wrote:

Hi Erick,

have a look at the integration tests
in org.elasticsearch.test.integration.indices.analyze, then you find an
example

AnalyzeResponse analyzeResponse = client.admin().indices().prepareAnalyze(
"test", "this is a test").execute().actionGet();
Cheers,

Jörg

On Monday, November 5, 2012 8:45:34 PM UTC+1, Erick Lee wrote:

Hi,

Is there a version of the analyze api available to the Java client? I
looked around and didn't find it.

I'd like to search for documents that start with a phrase. SpanFirst
looks like it lets me search for terms at the start, so I'd like to run the
phrase through the analyzer for the field.

Thanks!

--


(system) #5