Newbie elasticssearch questions


(didier deshommes) #1

Hi there,
I'd like to know if elasticsearch displays scores for document
matches. Also, how is this score calculated across indices? Is the
score local to the index?

How can I boost terms when making a query? For example: I want to
search for terms "money" and "cash" but give more importance to
"money". My query would look like "money"^10 OR "cash". How do I do
that in elasticsearch?

Does elasticsearch support raw lucene queries?

Thanks!
didier


(Shay Banon) #2

On Wxed, Mar 31, 2010 at 9:02 PM, didier deshommes dfdeshom@gmail.comwrote:

Hi there,
I'd like to know if elasticsearch displays scores for document
matches. Also, how is this score calculated across indices? Is the
score local to the index?

Score is calculated in a similar manner as you opening a MultiSearcher on
top of several indices in Lucene (I assume that you have Lucene knowledge
based on your questions). As you know, score itself is meaningless in Lucene
when you get it back as part of a hit (meaningless in a user sense). See
more here:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/#Search_Type
.

How can I boost terms when making a query? For example: I want to
search for terms "money" and "cash" but give more importance to
"money". My query would look like "money"^10 OR "cash". How do I do
that in elasticsearch?

If you know Lucene queries, then you will find the following query DSL
familiar:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/. This is
the query API elasticsearch provides.

Does elasticsearch support raw lucene queries?

You mean your custom built ones? There is an extension point for that, if
you need it, I will explain how to implement it.

Thanks!
didier


(didier deshommes) #3

On Wed, Mar 31, 2010 at 12:24 PM, Shay Banon
shay.banon@elasticsearch.com wrote:

On Wxed, Mar 31, 2010 at 9:02 PM, didier deshommes dfdeshom@gmail.com
wrote:

Hi ,thanks for replying to my questions!

If you know Lucene queries, then you will find the following query DSL
familiar: http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/.
This is the query API elasticsearch provides.

It looks like you could pass arbitrary luce queries to queryString, is
that correct? i.e. something like:

{
"queryString" : {

    "query" : "+content:(this AND that OR thus^2.0) -other_field:other"
}

}

Does elasticsearch support raw lucene queries?

You mean your custom built ones? There is an extension point for that, if
you need it, I will explain how to implement it.

Could you elaborate more on that?

didier

Thanks!
didier


(Shay Banon) #4

On Fri, Apr 2, 2010 at 7:11 AM, didier deshommes dfdeshom@gmail.com wrote:

On Wed, Mar 31, 2010 at 12:24 PM, Shay Banon
shay.banon@elasticsearch.com wrote:

On Wxed, Mar 31, 2010 at 9:02 PM, didier deshommes dfdeshom@gmail.com
wrote:

Hi ,thanks for replying to my questions!

No problem. Just so I know how to answer my questions, are you familiar with
Lucene?

If you know Lucene queries, then you will find the following query DSL
familiar:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/.
This is the query API elasticsearch provides.

It looks like you could pass arbitrary luce queries to queryString, is
that correct? i.e. something like:

{
"queryString" : {

   "query" : "+content:(this AND that OR thus^2.0) -other_field:other"
}

}

In elasticsearch sense, this is a queryString query, which simply uses
Lucene QueryParser (with extra logic on top) to parse the query string into
a query. Within the query string, you can indeed describe the query you
want. You can also build your query out of bool/term/field/rage/... queries
that you have (each mapping to the respective Lucene query). Check the query
DSL.

Does elasticsearch support raw lucene queries?

You mean your custom built ones? There is an extension point for that, if
you need it, I will explain how to implement it.

Could you elaborate more on that?

Depends. Do you want to use a custom Lucene Query that you wrote and you did
not find at the query DSL?

didier

Thanks!
didier


(didier deshommes) #5

On Fri, Apr 2, 2010 at 4:47 AM, Shay Banon shay.banon@elasticsearch.com wrote:

On Fri, Apr 2, 2010 at 7:11 AM, didier deshommes dfdeshom@gmail.com wrote:

On Wed, Mar 31, 2010 at 12:24 PM, Shay Banon
shay.banon@elasticsearch.com wrote:

On Wxed, Mar 31, 2010 at 9:02 PM, didier deshommes dfdeshom@gmail.com
wrote:

Hi ,thanks for replying to my questions!

No problem. Just so I know how to answer my questions, are you familiar with
Lucene?

Yes I am.

If you know Lucene queries, then you will find the following query DSL

familiar: http://www.elasticsearch.com/docs/elasticsearch/rest_api/query_dsl/.
This is the query API elasticsearch provides.

It looks like you could pass arbitrary luce queries to queryString, is
that correct? i.e. something like:

{
"queryString" : {

   "query" : "+content:(this AND that OR thus^2.0) -other_field:other"

}
}

In elasticsearch sense, this is a queryString query, which simply uses
Lucene QueryParser (with extra logic on top) to parse the query string into
a query. Within the query string, you can indeed describe the query you
want. You can also build your query out of bool/term/field/rage/... queries
that you have (each mapping to the respective Lucene query). Check the query
DSL.

Cool, I think that answers my question :slight_smile:

didier


(system) #6