Query DSL


(Cédric) #1

Hi,

First of all, I'd like to say I'm really impressed with what you've
done with ElasticSearch. Definitely looks like a Solr killer. Using it
with Groovy is really neat. However, I have a question about the query
DSL : is there any plan to integrate span queries (or is it just
undocumented) ?

BTW, is there any developer documentation about writing plugins ?
Specifically, I think I'll have to integrate custom analyzers. I will
certainly take a look at the ICU plugin source but an overview would
be great.

Thanks,


(Shay Banon) #2

There is support for span queries already, I just haven't got around to
document it... (its in 0.8). Can you open an issue so I will doc them (just
so I won't forget about them again :wink: ).

Regarding writing plugins, there is no docs yet, though you don't have to
write a plugin to provide custom analyzers, though you will need to write
some custom code for that, which might as well be in the form of plugins.
The ICU plugin is a good place to see how to write custom analyzers plugin,
and I would love help in documenting it on the github wiki.

-shay.banon

On Fri, Jun 25, 2010 at 5:41 PM, Cédric cedric.champeau@gmail.com wrote:

Hi,

First of all, I'd like to say I'm really impressed with what you've
done with ElasticSearch. Definitely looks like a Solr killer. Using it
with Groovy is really neat. However, I have a question about the query
DSL : is there any plan to integrate span queries (or is it just
undocumented) ?

BTW, is there any developer documentation about writing plugins ?
Specifically, I think I'll have to integrate custom analyzers. I will
certainly take a look at the ICU plugin source but an overview would
be great.

Thanks,


(Shay Banon) #3

No need for an issue regarding span queries, just documented them:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/.

On Fri, Jun 25, 2010 at 9:40 PM, Shay Banon shay.banon@elasticsearch.comwrote:

There is support for span queries already, I just haven't got around to
document it... (its in 0.8). Can you open an issue so I will doc them (just
so I won't forget about them again :wink: ).

Regarding writing plugins, there is no docs yet, though you don't have to
write a plugin to provide custom analyzers, though you will need to write
some custom code for that, which might as well be in the form of plugins.
The ICU plugin is a good place to see how to write custom analyzers plugin,
and I would love help in documenting it on the github wiki.

-shay.banon

On Fri, Jun 25, 2010 at 5:41 PM, Cédric cedric.champeau@gmail.com wrote:

Hi,

First of all, I'd like to say I'm really impressed with what you've
done with ElasticSearch. Definitely looks like a Solr killer. Using it
with Groovy is really neat. However, I have a question about the query
DSL : is there any plan to integrate span queries (or is it just
undocumented) ?

BTW, is there any developer documentation about writing plugins ?
Specifically, I think I'll have to integrate custom analyzers. I will
certainly take a look at the ICU plugin source but an overview would
be great.

Thanks,


(Cédric) #4

Nice, I'll take a look. Thanks.

On 25 juin, 20:40, Shay Banon shay.ba...@elasticsearch.com wrote:

There is support for span queries already, I just haven't got around to
document it... (its in 0.8). Can you open an issue so I will doc them (just
so I won't forget about them again :wink: ).

Regarding writing plugins, there is no docs yet, though you don't have to
write a plugin to provide custom analyzers, though you will need to write
some custom code for that, which might as well be in the form of plugins.
The ICU plugin is a good place to see how to write custom analyzers plugin,
and I would love help in documenting it on the github wiki.

-shay.banon

On Fri, Jun 25, 2010 at 5:41 PM, Cédric cedric.champ...@gmail.com wrote:

Hi,

First of all, I'd like to say I'm really impressed with what you've
done with ElasticSearch. Definitely looks like a Solr killer. Using it
with Groovy is really neat. However, I have a question about the query
DSL : is there any plan to integrate span queries (or is it just
undocumented) ?

BTW, is there any developer documentation about writing plugins ?
Specifically, I think I'll have to integrate custom analyzers. I will
certainly take a look at the ICU plugin source but an overview would
be great.

Thanks,


(Cédric) #5

Hi again,

I'm having troubles with the Groovy API. There must be something I
don't write correctly, because the span_term items are null when I
inspect the generated query (the clauses list contains two null
elements). Have you got an idea of where I'm wrong ?

def search = searchService.client.search {
indices "test"
types "validation"
source {
size = 100
query {
span_near {
clauses = [
span_term(topic: "term1"),
span_term(topic: "term2")
]
slop = 2
in_order = true
}
}
}
}

Thanks !

On 25 juin, 20:40, Shay Banon shay.ba...@elasticsearch.com wrote:

There is support for span queries already, I just haven't got around to
document it... (its in 0.8). Can you open an issue so I will doc them (just
so I won't forget about them again :wink: ).

Regarding writing plugins, there is no docs yet, though you don't have to
write a plugin to provide custom analyzers, though you will need to write
some custom code for that, which might as well be in the form of plugins.
The ICU plugin is a good place to see how to write custom analyzers plugin,
and I would love help in documenting it on the github wiki.

-shay.banon

On Fri, Jun 25, 2010 at 5:41 PM, Cédric cedric.champ...@gmail.com wrote:

Hi,

First of all, I'd like to say I'm really impressed with what you've
done with ElasticSearch. Definitely looks like a Solr killer. Using it
with Groovy is really neat. However, I have a question about the query
DSL : is there any plan to integrate span queries (or is it just
undocumented) ?

BTW, is there any developer documentation about writing plugins ?
Specifically, I think I'll have to integrate custom analyzers. I will
certainly take a look at the ICU plugin source but an overview would
be great.

Thanks,


(Shay Banon) #6

Ok, finally found the problem for this. Basically, the way it works is that
the top level closure is simply evaluated as a closure against the
SearchRequest class. The source is special, and its built into json (in an
optimized manner), which represents the search source.

Building this into json uses the same mechanism grails uses to build json
(grails JSONBuilder), and its always tricky to understand what it does
(especially since i am not groovy export ; ). But, I got what you wanted to
generate a proper json. Below, you can find the way that I tested it, so it
will be simpler to understand and debug what gets generated at the end (this
is what the source gets injected with):

    def builder = new GXContentBuilder()

    def test = builder.buildAsString {
        size = 100
        query {
            span_near {
                clauses = [
                        { span_term(topic: "term1") },
                        { span_term(topic: "term2") }
                ]
                slop = 2
                in_order = true
            }
        }
    }

    println test

Note the above, the space_term needs to be wrapped with { ... }.

-shay.banon

On Tue, Jun 29, 2010 at 11:03 AM, Cédric cedric.champeau@gmail.com wrote:

Hi again,

I'm having troubles with the Groovy API. There must be something I
don't write correctly, because the span_term items are null when I
inspect the generated query (the clauses list contains two null
elements). Have you got an idea of where I'm wrong ?

def search = searchService.client.search {
indices "test"
types "validation"
source {
size = 100
query {
span_near {
clauses = [

span_term(topic: "term1"),

span_term(topic: "term2")
]
slop = 2
in_order = true
}
}
}
}

Thanks !

On 25 juin, 20:40, Shay Banon shay.ba...@elasticsearch.com wrote:

There is support for span queries already, I just haven't got around to
document it... (its in 0.8). Can you open an issue so I will doc them
(just
so I won't forget about them again :wink: ).

Regarding writing plugins, there is no docs yet, though you don't have to
write a plugin to provide custom analyzers, though you will need to write
some custom code for that, which might as well be in the form of plugins.
The ICU plugin is a good place to see how to write custom analyzers
plugin,
and I would love help in documenting it on the github wiki.

-shay.banon

On Fri, Jun 25, 2010 at 5:41 PM, Cédric cedric.champ...@gmail.com
wrote:

Hi,

First of all, I'd like to say I'm really impressed with what you've
done with ElasticSearch. Definitely looks like a Solr killer. Using it
with Groovy is really neat. However, I have a question about the query
DSL : is there any plan to integrate span queries (or is it just
undocumented) ?

BTW, is there any developer documentation about writing plugins ?
Specifically, I think I'll have to integrate custom analyzers. I will
certainly take a look at the ICU plugin source but an overview would
be great.

Thanks,


(system) #7