Plug in a custom query in ES

Hi,

How can I dynamically plug a custom query in ES?

What I did for the moment, is to modify the IndecesQueryRegistry and there
I added the following line:

addQueryParser(queryParsers, new AATermQueryParser());

where AATermQueryParser is the parser for my custom query syntax. I'm
working with the ES source code.
But I'm interested in doing this dynamically.

So, any suggestions?

Thnx in advance,

Alex

Write a plugin that does that. You can write a class that gest injected
with IndicesQueriesRegistry, and adds teh relevant parsers you want, and
write a module that registers your class.

On Mon, Nov 28, 2011 at 11:29 AM, Sisu Alexandru sisu.eugen@gmail.comwrote:

Hi,

How can I dynamically plug a custom query in ES?

What I did for the moment, is to modify the IndecesQueryRegistry and there
I added the following line:

addQueryParser(queryParsers, new AATermQueryParser());

where AATermQueryParser is the parser for my custom query syntax. I'm
working with the ES source code.
But I'm interested in doing this dynamically.

So, any suggestions?

Thnx in advance,

Alex

Thnx for the tip. I didnt used the IndicesQueriesRegistry.
Instead I used the IndexQueryParserModule.

@Override public void processModule(Module module) {

    if (module instanceof IndexQueryParserModule) {

    System.out.println("---------> Registering AATermQueryParser");

        ((IndexQueryParserModule) module).addQueryParser("aaterm",

AATermQueryParser.class);

    }

}

Tnx,

Alex

On Mon, Nov 28, 2011 at 12:33 PM, Shay Banon kimchy@gmail.com wrote:

Write a plugin that does that. You can write a class that gest injected
with IndicesQueriesRegistry, and adds teh relevant parsers you want, and
write a module that registers your class.

On Mon, Nov 28, 2011 at 11:29 AM, Sisu Alexandru sisu.eugen@gmail.comwrote:

Hi,

How can I dynamically plug a custom query in ES?

What I did for the moment, is to modify the IndecesQueryRegistry and
there I added the following line:

addQueryParser(queryParsers, new AATermQueryParser());

where AATermQueryParser is the parser for my custom query syntax. I'm
working with the ES source code.
But I'm interested in doing this dynamically.

So, any suggestions?

Thnx in advance,

Alex

That would work as well :slight_smile:

On Mon, Nov 28, 2011 at 6:16 PM, Sisu Alexandru sisu.eugen@gmail.comwrote:

Thnx for the tip. I didnt used the IndicesQueriesRegistry.
Instead I used the IndexQueryParserModule.

@Override public void processModule(Module module) {

    if (module instanceof IndexQueryParserModule) {

    System.out.println("---------> Registering AATermQueryParser");

        ((IndexQueryParserModule) module).addQueryParser("aaterm",

AATermQueryParser.class);

    }

}

Tnx,

Alex

On Mon, Nov 28, 2011 at 12:33 PM, Shay Banon kimchy@gmail.com wrote:

Write a plugin that does that. You can write a class that gest injected
with IndicesQueriesRegistry, and adds teh relevant parsers you want, and
write a module that registers your class.

On Mon, Nov 28, 2011 at 11:29 AM, Sisu Alexandru sisu.eugen@gmail.comwrote:

Hi,

How can I dynamically plug a custom query in ES?

What I did for the moment, is to modify the IndecesQueryRegistry and
there I added the following line:

addQueryParser(queryParsers, new AATermQueryParser());

where AATermQueryParser is the parser for my custom query syntax. I'm
working with the ES source code.
But I'm interested in doing this dynamically.

So, any suggestions?

Thnx in advance,

Alex