ElasticSearch

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Yonik Seeley-2-2
On Thu, Nov 17, 2011 at 3:40 PM, Mark Harwood <[hidden email]> wrote:
> JSON or XML can reflect more closely the hierarchy in the underlying Lucene query objects.

We normally use the Lucene QueryParser syntax itself for that (not
HTTP parameters).

Other parameters such as filters, faceting, highlighting, sorting,
etc, don't normally have any hierarchy.

I don't think JSON is always nicer either.  How would you write this
sort in JSON for example?
sort=price desc, score desc

A big plus to Solr's APIs is that it's relatively easy to type them in
to a browser to try them out.

As far as alternate query syntaxes (as opposed to alternate request
syntaxes), Solr has good support for that and
it would be simple to add in support for a JSON query syntax if
someone wrote one.
AFAIK, there's an issue open for adding the XML query syntax, but I'm
not sure if it's ever had much traction.

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Yonik Seeley-2-2
In reply to this post by Michael McCandless-2
On Thu, Nov 17, 2011 at 3:44 PM, Michael McCandless
<[hidden email]> wrote:
> Maybe someone can post the equivalent query in ElasticSearch?

I don't think it's possible.  Hoss threw in the kitchen sink into his
"contrived' example.
Here's a super simple example:

JSON:

{
    "sort" : [
        { "age" : {"order" : "asc"} }
    ],
    "query" : {
        "term" : { "user" : "jack" }
    }
}

Solr's HTTP:

q=user:jack&sort=age asc

-Yonik
http://www.lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

mark harwood
In reply to this post by Yonik Seeley-2-2
>
> Other parameters such as filters, faceting, highlighting, sorting,
> etc, don't normally have any hierarchy.


I regularly mix filters and queries inside Boolean logic. Attempts to structure data (e.g. geocoding) don't always achieve 100% coverage and so for better recall you must also resort to unstructured text as well. You end up with something like this (pseudo code)...

  (text:Windsor OR geoRangeFilter:xxxxx) AND text:pizza
 
 
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Chris Hostetter-3
In reply to this post by Yonik Seeley-2-2

: > Maybe someone can post the equivalent query in ElasticSearch?
:
: I don't think it's possible.  Hoss threw in the kitchen sink into his
: "contrived' example.

exactly ... i have no idea if that type of query is possible with ES, but
it was not intended to be an example of a "typical" Solr query -- or even
a useful query -- it was a deliberately contrived example of a complex and
"deep" query structure that could be crafted using nested query params and
variable refs.

There's nothing stoping us from having an XML or JSON based query langauge
(patches welcome!), but my point was you can already express quite a bit
of complexity and nuance in Solr queries OOTB today.


-Hoss

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Peter
In reply to this post by Yonik Seeley-2-2


> I don't think it's possible.

Eh, of course its possible (if I would understand it I would do it. no,
no, just joking ;))

and yes, Solr its a shorter for some common use cases. I don't think
that there is a 'best', but JSON can map 1:1 to lucene.

The biggest problem with ES's syntax is that you can have super big
queries where you miss the big picture or some closing bracket (probably
</xml> would be better ;))
=> so this makes it sometimes harder to 'parse' for humans (for bigger
queries) and more chatty

The biggest problem with Solr's syntax is that you need to escape here
and there and you have all the different brackets and dots (e.g. for
ranges, local params, term filter, ...),
which makes it hard to parse for *non*-humans and sub-intelligent people
IMO. An advantage is that you can put the URL into the browser with
Solr, which is only possible via additional software for ES (called
Elasticsearch-head). although some parameters are available as URL
parameters as well in ES

Regards,
Peter.


> On Thu, Nov 17, 2011 at 3:44 PM, Michael McCandless
> <[hidden email]> wrote:
>> Maybe someone can post the equivalent query in ElasticSearch?
> I don't think it's possible.  Hoss threw in the kitchen sink into his
> "contrived' example.
> Here's a super simple example:
>
> JSON:
>
> {
>     "sort" : [
>         { "age" : {"order" : "asc"} }
>     ],
>     "query" : {
>         "term" : { "user" : "jack" }
>     }
> }
>
> Solr's HTTP:
>
> q=user:jack&sort=age asc
>
> -Yonik
> http://www.lucidimagination.com
>



--
http://jetsli.de news reader for geeks

Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Mark Miller-3
The XML query parser can map to Lucene one to one as well - hasn't seemed
to pick up enough steam to be included with Solr yet, but there has been
some commotion so it's likely to go in at some point. Not enough demand yet
I guess. https://issues.apache.org/jira/browse/SOLR-839 XML Query Parser
Support

--
- Mark

http://www.lucidimagination.com

On Thu, Nov 17, 2011 at 6:11 PM, Peter Karich <[hidden email]> wrote:

>
>
> > I don't think it's possible.
>
> Eh, of course its possible (if I would understand it I would do it. no,
> no, just joking ;))
>
> and yes, Solr its a shorter for some common use cases. I don't think
> that there is a 'best', but JSON can map 1:1 to lucene.
>
> The biggest problem with ES's syntax is that you can have super big
> queries where you miss the big picture or some closing bracket (probably
> </xml> would be better ;))
> => so this makes it sometimes harder to 'parse' for humans (for bigger
> queries) and more chatty
>
> The biggest problem with Solr's syntax is that you need to escape here
> and there and you have all the different brackets and dots (e.g. for
> ranges, local params, term filter, ...),
> which makes it hard to parse for *non*-humans and sub-intelligent people
> IMO. An advantage is that you can put the URL into the browser with
> Solr, which is only possible via additional software for ES (called
> Elasticsearch-head). although some parameters are available as URL
> parameters as well in ES
>
> Regards,
> Peter.
>
>
> > On Thu, Nov 17, 2011 at 3:44 PM, Michael McCandless
> > <[hidden email]> wrote:
> >> Maybe someone can post the equivalent query in ElasticSearch?
> > I don't think it's possible.  Hoss threw in the kitchen sink into his
> > "contrived' example.
> > Here's a super simple example:
> >
> > JSON:
> >
> > {
> >     "sort" : [
> >         { "age" : {"order" : "asc"} }
> >     ],
> >     "query" : {
> >         "term" : { "user" : "jack" }
> >     }
> > }
> >
> > Solr's HTTP:
> >
> > q=user:jack&sort=age asc
> >
> > -Yonik
> > http://www.lucidimagination.com
> >
>
>
>
> --
> http://jetsli.de news reader for geeks
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Lukáš Vlček
In reply to this post by Peter
Hi Peter,

On Fri, Nov 18, 2011 at 12:11 AM, Peter Karich <[hidden email]> wrote:

>
>
> > I don't think it's possible.
>
> Eh, of course its possible (if I would understand it I would do it. no,
> no, just joking ;))
>
> and yes, Solr its a shorter for some common use cases. I don't think
> that there is a 'best', but JSON can map 1:1 to lucene.
>
> The biggest problem with ES's syntax is that you can have super big
> queries where you miss the big picture or some closing bracket (probably
> </xml> would be better ;))
> => so this makes it sometimes harder to 'parse' for humans (for bigger
> queries) and more chatty
>
> The biggest problem with Solr's syntax is that you need to escape here
> and there and you have all the different brackets and dots (e.g. for
> ranges, local params, term filter, ...),
> which makes it hard to parse for *non*-humans and sub-intelligent people
> IMO. An advantage is that you can put the URL into the browser with
> Solr, which is only possible via additional software for ES (called
> Elasticsearch-head). although some parameters are available as URL
> parameters as well in ES
>

Not sure if I understood exactly what you meant here but do you know you
can always use "source" URL parameter to pass in any DSL query string in
ES? In other words, just take DSL query JSON and pass it as a URL parameter
(mostly handy for JSONP). And there are a lot of tools that can support you
here, not only ES-head, but also REST plugins for web browsers if you do
not mind writing the JSON query yourself (not to mention that in many
programming languages it is much easier to work with JSON then it is in
Java).


>
> Regards,
> Peter.
>
>
> > On Thu, Nov 17, 2011 at 3:44 PM, Michael McCandless
> > <[hidden email]> wrote:
> >> Maybe someone can post the equivalent query in ElasticSearch?
> > I don't think it's possible.  Hoss threw in the kitchen sink into his
> > "contrived' example.
> > Here's a super simple example:
> >
> > JSON:
> >
> > {
> >     "sort" : [
> >         { "age" : {"order" : "asc"} }
> >     ],
> >     "query" : {
> >         "term" : { "user" : "jack" }
> >     }
> > }
> >
> > Solr's HTTP:
> >
> > q=user:jack&sort=age asc
> >
> > -Yonik
> > http://www.lucidimagination.com
> >
>
>
>
> --
> http://jetsli.de news reader for geeks
>
>
Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Peter
 Hi Lukáš, hi Mark

> https://issues.apache.org/jira/browse/SOLR-839 


thanks for pointing me there


> >  although some parameters are available as URL parameters as well in ES

> Not sure if I understood exactly what you meant here but do you know you
> can always use "source" URL parameter to pass in any DSL query string in
> ES?

ah, ok. thanks

> And there are a lot of tools that can support you
> here, not only ES-head, but also REST plugins for web browsers

yes, thats what I meant (but the point was: you need the tool)

Regards,
Peter.

--
http://jetsli.de news reader for geeks


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: ElasticSearch

Robust Links
Thank you all for the feedback and your point of views.

Peyman


On Nov 18, 2011, at 2:47 AM, Peter Karich wrote:

> Hi Lukáš, hi Mark
>
>> https://issues.apache.org/jira/browse/SOLR-839 
>
>
> thanks for pointing me there
>
>
>>> although some parameters are available as URL parameters as well in ES
>
>> Not sure if I understood exactly what you meant here but do you know you
>> can always use "source" URL parameter to pass in any DSL query string in
>> ES?
>
> ah, ok. thanks
>
>> And there are a lot of tools that can support you
>> here, not only ES-head, but also REST plugins for web browsers
>
> yes, thats what I meant (but the point was: you need the tool)
>
> Regards,
> Peter.
>
> --
> http://jetsli.de news reader for geeks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12