Registering a Custom Query Builder


(Samuel Doyle) #1

I created a custom query builder but it looks like I somehow need to
register it with ElasticSearch since I encounter a SearchParseException
which says
"No query parser registered for ... "

How do I go about doing this?

Thanks.


(Shay Banon) #2

You can either write a plugin that automatically registers it under your
special name, or configure elasticsearch to use it. You can have a look at
the elasticsearch tests to see how its done, check
out org.elasticsearch.index.query.xcontent.plugin
and org.elasticsearch.index.query.xcontent.guice in the test area of the
elasticsearch module.

-shay.banon

On Mon, Jun 28, 2010 at 4:54 AM, Samuel Doyle samueldoyle@gmail.com wrote:

I created a custom query builder but it looks like I somehow need to
register it with ElasticSearch since I encounter a SearchParseException
which says
"No query parser registered for ... "

How do I go about doing this?

Thanks.


(Samuel Doyle) #3

Great thanks!

On Mon, Jun 28, 2010 at 4:57 AM, Shay Banon shay.banon@elasticsearch.comwrote:

You can either write a plugin that automatically registers it under your
special name, or configure elasticsearch to use it. You can have a look at
the elasticsearch tests to see how its done, check
out org.elasticsearch.index.query.xcontent.plugin
and org.elasticsearch.index.query.xcontent.guice in the test area of the
elasticsearch module.

-shay.banon

On Mon, Jun 28, 2010 at 4:54 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I created a custom query builder but it looks like I somehow need to
register it with ElasticSearch since I encounter a SearchParseException
which says
"No query parser registered for ... "

How do I go about doing this?

Thanks.


(Samuel Doyle) #4

Hi,

I had a chance to look at this the other day and attempted to register my
custom queryparser based on your test.
The default settingsBuilder expects to have your parser within a package
org.elasticsearch... or it will throw an exception saying so. Do I need to
override the method that does this prefix check? I'm also now wondering
about the settings themselves. I'm assuming if I'm a client I don't really
need too much in the settings since most of this is configured via the
elasticsearch.yml for each of the nodes and that the passed in settings can
be empty for the most part?

So when I get to this point does the create injector call goes out and
register the parser with all the discovered nodes? Is this something that
needs to be done in another way or does just performing this operation from
the client suffice?

Thanks

On Mon, Jun 28, 2010 at 6:26 AM, Samuel Doyle samueldoyle@gmail.com wrote:

Great thanks!

On Mon, Jun 28, 2010 at 4:57 AM, Shay Banon shay.banon@elasticsearch.comwrote:

You can either write a plugin that automatically registers it under your
special name, or configure elasticsearch to use it. You can have a look at
the elasticsearch tests to see how its done, check
out org.elasticsearch.index.query.xcontent.plugin
and org.elasticsearch.index.query.xcontent.guice in the test area of the
elasticsearch module.

-shay.banon

On Mon, Jun 28, 2010 at 4:54 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I created a custom query builder but it looks like I somehow need to
register it with ElasticSearch since I encounter a SearchParseException
which says
"No query parser registered for ... "

How do I go about doing this?

Thanks.


(Shay Banon) #5

On Wed, Jun 30, 2010 at 1:52 PM, Samuel Doyle samueldoyle@gmail.com wrote:

Hi,

I had a chance to look at this the other day and attempted to register my
custom queryparser based on your test.
The default settingsBuilder expects to have your parser within a package
org.elasticsearch... or it will throw an exception saying so. Do I need to
override the method that does this prefix check?

You simple call a different constructor, with the last parameter specifying
the settings prefix you want to use (a different constructor in
AbstractIndexComponent).

I'm also now wondering about the settings themselves. I'm assuming if I'm a
client I don't really need too much in the settings since most of this is
configured via the elasticsearch.yml for each of the nodes and that the
passed in settings can be empty for the most part?

Not sure I understand. The settings will come from the yaml file, but most
times, with query parsers, most parameters would come within the json the
user provides in the Query DSL (you can see that all query parsers in
elasticsearch do not use anything from the settings).

So when I get to this point does the create injector call goes out and
register the parser with all the discovered nodes? Is this something that
needs to be done in another way or does just performing this operation from
the client suffice?

Not really sure what you decided to go with, which integration? The one
using a plugin, or through the configuration?

Thanks

On Mon, Jun 28, 2010 at 6:26 AM, Samuel Doyle samueldoyle@gmail.comwrote:

Great thanks!

On Mon, Jun 28, 2010 at 4:57 AM, Shay Banon <shay.banon@elasticsearch.com

wrote:

You can either write a plugin that automatically registers it under your
special name, or configure elasticsearch to use it. You can have a look at
the elasticsearch tests to see how its done, check
out org.elasticsearch.index.query.xcontent.plugin
and org.elasticsearch.index.query.xcontent.guice in the test area of the
elasticsearch module.

-shay.banon

On Mon, Jun 28, 2010 at 4:54 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I created a custom query builder but it looks like I somehow need to
register it with ElasticSearch since I encounter a SearchParseException
which says
"No query parser registered for ... "

How do I go about doing this?

Thanks.


(Samuel Doyle) #6

Thanks, I'm trying to use the plugin and ideally it should only apply to the
client so hopefully it doesn't do any updates to the running nodes.

Thanks

On Wed, Jun 30, 2010 at 9:56 AM, Shay Banon shay.banon@elasticsearch.comwrote:

On Wed, Jun 30, 2010 at 1:52 PM, Samuel Doyle samueldoyle@gmail.comwrote:

Hi,

I had a chance to look at this the other day and attempted to register my
custom queryparser based on your test.
The default settingsBuilder expects to have your parser within a package
org.elasticsearch... or it will throw an exception saying so. Do I need to
override the method that does this prefix check?

You simple call a different constructor, with the last parameter specifying
the settings prefix you want to use (a different constructor in
AbstractIndexComponent).

I'm also now wondering about the settings themselves. I'm assuming if I'm
a client I don't really need too much in the settings since most of this is
configured via the elasticsearch.yml for each of the nodes and that the
passed in settings can be empty for the most part?

Not sure I understand. The settings will come from the yaml file, but most
times, with query parsers, most parameters would come within the json the
user provides in the Query DSL (you can see that all query parsers in
elasticsearch do not use anything from the settings).

So when I get to this point does the create injector call goes out and
register the parser with all the discovered nodes? Is this something that
needs to be done in another way or does just performing this operation from
the client suffice?

Not really sure what you decided to go with, which integration? The one
using a plugin, or through the configuration?

Thanks

On Mon, Jun 28, 2010 at 6:26 AM, Samuel Doyle samueldoyle@gmail.comwrote:

Great thanks!

On Mon, Jun 28, 2010 at 4:57 AM, Shay Banon <
shay.banon@elasticsearch.com> wrote:

You can either write a plugin that automatically registers it under your
special name, or configure elasticsearch to use it. You can have a look at
the elasticsearch tests to see how its done, check
out org.elasticsearch.index.query.xcontent.plugin
and org.elasticsearch.index.query.xcontent.guice in the test area of the
elasticsearch module.

-shay.banon

On Mon, Jun 28, 2010 at 4:54 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I created a custom query builder but it looks like I somehow need to
register it with ElasticSearch since I encounter a SearchParseException
which says
"No query parser registered for ... "

How do I go about doing this?

Thanks.


(system) #7