How to get score value of elasticsearch document from zdb query
70 views
Skip to first unread message
samanth...@gmail.com
unread,
Dec 12, 2016, 7:31:53 AM12/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ZomboDB
Hi,
I am using Zombo DB since few weeks. I am feeling so happy about the feature zombo is providing.
I have a requirement where I need score value of elasticsearch document.
Can you please help me to get score value?
Thanks, Samanth
Eric B. Ridge
unread,
Dec 12, 2016, 2:34:34 PM12/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to zom...@googlegroups.com
Hi Samanth! I'm pleased you like ZomboDB!
Scoring is pretty easy. ZDB provides a SQL function named
"zdb_score()" that works similarly to the "zdb()" function you use to
query. It is documented here:
As the docs indicate, you can use the function as an output column and
use it in your ORDER BY clause (which is required if you want results
ordered by score).
If the docs don't provide enough information, please let me know.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ZomboDB
Thank you very much! Eric.
I will check now.
Regards, Samanth
samanth...@gmail.com
unread,
Dec 13, 2016, 12:46:40 PM12/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ZomboDB, samanth...@gmail.com
Thank you Eric. I am able to get the score of elasticsearch document
But my requirement is not satisfied. Here is my requirement: I need matching score between search value and resultant records.
This is how I tried: I am getting different score values but I am expecting 100 as score value here, because I am doing exact search using class_id.. ex:- SELECT zdb_score('recordid_gen.idserver_request_log', idserver_request_log.ctid), * FROM recordid_gen.idserver_request_log WHERE zdb('recordid_gen.idserver_request_log', idserver_request_log.ctid) ==> 'class_id:("O.277968-840.205757.0")'
May be I am misunderstanding score value?
Please help me here how to get matching score..
Thanks, Samanth
Eric B. Ridge
unread,
Dec 13, 2016, 2:44:03 PM12/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to zom...@googlegroups.com, samanth...@gmail.com
What score value are you getting back? ZDB doesn't do anything special
with the scores. It simply returns whatever Elasticsearch calculates
the score to be.