Boost when you make a Query


(vgross) #1

Hi ,

I try to choose the "boost" on my different field when i make a simple
search query my result is not what i'm expect :frowning:

Whit this simple mapping, for exemple :

$mapping->setProperties(array(
'libelle' => array('type' => 'string', 'include_in_all' => TRUE),
'description' => array('type' => 'string', 'include_in_all' => TRUE)
));

I would like to have a better "boost" on my field 'libelle'

'query' => array(
'text' => array(
'libelle' => array(
'query' => $_POST['searchQuery'],
'boost' => 9
)
),
'text' => array(
'description' => array(
'query' => $_POST['searchQuery'],
'boost' => 0.2
)
)
)

If anyone can help me...

Thanx


(David Pilato) #2

I've answered on the french mailing list that I use this :
http://www.elasticsearch.org/guide/reference/query-dsl/field-query.html

David

Le 28 mai 2012 à 11:26, Vincent GROSS vince.gross@gmail.com a écrit :

Hi ,

I try to choose the "boost" on my different field when i make a simple search query my result is not what i'm expect :frowning:

Whit this simple mapping, for exemple :

$mapping->setProperties(array(
'libelle' => array('type' => 'string', 'include_in_all' => TRUE),
'description' => array('type' => 'string', 'include_in_all' => TRUE)
));

I would like to have a better "boost" on my field 'libelle'

'query' => array(
'text' => array(
'libelle' => array(
'query' => $_POST['searchQuery'],
'boost' => 9
)
),
'text' => array(
'description' => array(
'query' => $_POST['searchQuery'],
'boost' => 0.2
)
)
)

If anyone can help me...

Thanx


(Shay Banon) #3

It might be that the structure of the query you send is wrong, you need to
wrap a compound query (two text queries) in a bool query (probably you want
should elements).

On Mon, May 28, 2012 at 11:26 AM, Vincent GROSS vince.gross@gmail.comwrote:

Hi ,

I try to choose the "boost" on my different field when i make a simple
search query my result is not what i'm expect :frowning:

Whit this simple mapping, for exemple :

$mapping->setProperties(array(
'libelle' => array('type' => 'string', 'include_in_all' => TRUE),
'description' => array('type' => 'string', 'include_in_all' => TRUE)
));

I would like to have a better "boost" on my field 'libelle'

'query' => array(
'text' => array(
'libelle' => array(
'query' => $_POST['searchQuery'],
'boost' => 9
)
),
'text' => array(
'description' => array(
'query' => $_POST['searchQuery'],
'boost' => 0.2
)
)
)

If anyone can help me...

Thanx


(system) #4