Get analyzer from client

Hi,

I have a java application which uses Elasticsearch client (transport
client). I need to analyze string taking mapping which is used by ES. I
know I can prepare analyze request to elasticsearch but it means a lot of
requests to ES. Is it possible to get somehow Lucene Analyzer from client
object and then use it to build TokenStream?

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

The AnalysisService is server-side only and not available in clients.

Jörg

On Sun, Oct 5, 2014 at 7:48 PM, Pawel prog88@gmail.com wrote:

Hi,

I have a java application which uses Elasticsearch client (transport
client). I need to analyze string taking mapping which is used by ES. I
know I can prepare analyze request to elasticsearch but it means a lot of
requests to ES. Is it possible to get somehow Lucene Analyzer from client
object and then use it to build TokenStream?

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoE4ivV2WGfMRx%3DBH4HRFxHxGHuvc2T4jiHNsp1izyxbYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

It is definitely possible. You can create the analysis service locally and
query it for the appropriate analyzers. I use this method the pre-analyze
terms for span queries, which does not analyze text. You would need a local
copy of your elasticsearch.yml and related files (stopwords, synonyms, etc)
or redefine everything in code.

Look at the existing test code for how to create an analysis service via
the guice injector. For example:

https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java

Cheers,

Ivan
On Oct 5, 2014 10:48 AM, "Pawel" prog88@gmail.com wrote:

Hi,

I have a java application which uses Elasticsearch client (transport
client). I need to analyze string taking mapping which is used by ES. I
know I can prepare analyze request to elasticsearch but it means a lot of
requests to ES. Is it possible to get somehow Lucene Analyzer from client
object and then use it to build TokenStream?

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQByAQdaWc3GpLun-5y_Z62Vx3qEZ7W%3DABON8-z5PCaM6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hi,
Thank you for all of those suggestions. I think this will work for me.

--
Paweł Róg

On Mon, Oct 6, 2014 at 4:54 AM, Ivan Brusic ivan@brusic.com wrote:

It is definitely possible. You can create the analysis service locally and
query it for the appropriate analyzers. I use this method the pre-analyze
terms for span queries, which does not analyze text. You would need a local
copy of your elasticsearch.yml and related files (stopwords, synonyms, etc)
or redefine everything in code.

Look at the existing test code for how to create an analysis service via
the guice injector. For example:

https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/index/analysis/CharFilterTests.java

Cheers,

Ivan
On Oct 5, 2014 10:48 AM, "Pawel" prog88@gmail.com wrote:

Hi,

I have a java application which uses Elasticsearch client (transport
client). I need to analyze string taking mapping which is used by ES. I
know I can prepare analyze request to elasticsearch but it means a lot of
requests to ES. Is it possible to get somehow Lucene Analyzer from client
object and then use it to build TokenStream?

--
Paweł Róg

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbNXoz3bX0AV1d1foSimx8xOFVniwKzz3o9RYvGK6V%3D4Fw%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQByAQdaWc3GpLun-5y_Z62Vx3qEZ7W%3DABON8-z5PCaM6g%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQByAQdaWc3GpLun-5y_Z62Vx3qEZ7W%3DABON8-z5PCaM6g%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9ZkbPBjn-k6y_G4R4C0H4Yx%2B0yVFJvPf4kCn9LJ%3DrS-gx8eQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.