About scripting elasticsearch with plugin lang-javascript

Hello,

I try to query with custom score (with param lang => js)
But, I didn't find documentation about the way to realise the script (acced
to the _source values, modify score etc.)

The score value that i need to personalize depends on the value of one
field :
if (myfield == '1234') {
score += 10;
} else if (myfield == '456' )
{
score += 20;
}

Thank you for your help.

Best regards,

It's the same as with mvel. You can find details
in Elasticsearch Platform — Find real-time answers at scale | Elastic

if (_source['myfield'] == '1234') {
_score + 10;
} else if (_source['myfield'] == '456') {
_score + 20;
} else {
_score;
}

On Thursday, June 21, 2012 10:49:03 AM UTC-4, gkcr2d2 wrote:

Hello,

I try to query with custom score (with param lang => js)
But, I didn't find documentation about the way to realise the script
(acced to the _source values, modify score etc.)

The score value that i need to personalize depends on the value of one
field :
if (myfield == '1234') {
score += 10;
} else if (myfield == '456' )
{
score += 20;
}

Thank you for your help.

Best regards,

Thank you !

Le vendredi 22 juin 2012 22:28:06 UTC+2, Igor Motov a écrit :

It's the same as with mvel. You can find details in
Elasticsearch Platform — Find real-time answers at scale | Elastic

if (_source['myfield'] == '1234') {
_score + 10;
} else if (_source['myfield'] == '456') {
_score + 20;
} else {
_score;
}

On Thursday, June 21, 2012 10:49:03 AM UTC-4, gkcr2d2 wrote:

Hello,

I try to query with custom score (with param lang => js)
But, I didn't find documentation about the way to realise the script
(acced to the _source values, modify score etc.)

The score value that i need to personalize depends on the value of one
field :
if (myfield == '1234') {
score += 10;
} else if (myfield == '456' )
{
score += 20;
}

Thank you for your help.

Best regards,