Hello
I have a data like this
Doctors_Name | Patient_Age | Patients_Sex | Dose | Patient_Is_Alive |
Wilson | 65 | Female | 40.5 | TRUE |
Jamison | 23 | Male | 60.7 | TRUE |
Thompson | 62 | Male | 60.7 | TRUE |
Paulson | 19 | Female | 400 | TRUE |
Daniels | 27 | Female | 60.6 | FALSE |
Allison | 84 | Male | 40 | FALSE |
Wilkes | 46 | Male | 60 | TRUE |
Hamilton | 86 | Male | 40 | FALSE |
Allison | 27 | Female | 40 | TRUE |
Wilson | 66 | Female | 60 | FALSE |
Hamilton | 85 | Male | 40 | TRUE |
Daniels | 74 | Male | 60 | FALSE |
Thompson | 78 | Female | 40 | TRUE |
Hamilton | 24 | Male | 60 | FALSE |
Hamilton | 62 | Male | 60 | TRUE |
Wilson | 59 | Female | 40 | FALSE |
Wilkes | 39 | Male | 60 | TRUE |
Thompson | 41 | Male | 40 | TRUE |
Daniels | 64 | Female | 60 | TRUE |
Hamilton | 58 | Male | 40 | TRUE |
Hamilton | 58 | Male | 40 | TRUE |
And i need to get all unique values for dose(Float).
{:query=>{:match_all=>{}}, :facets=>{"dose"=>{:terms=>{:size=>50000, :order=>nil, :field=>"dose"}}}}
it returns:
"terms"=>[
{"term"=>40.0, "count"=>8},
{"term"=>60.0, "count"=>6},
{"term"=>60.70000076293945, "count"=>2},
{"term"=>40.012123107910156, "count"=>2},
{"term"=>400.0, "count"=>1},
{"term"=>60.599998474121094, "count"=>1},
{"term"=>40.5, "count"=>1}
]
Why this happens ? Is there a way in elasticsearch to display original values ?
I also try to use script:
{:query=>{:match_all=>{}}, :facets=>{"dose"=>{:terms=>{:size=>50000, :order=>nil, :script=>"_source.dose"}}}}
It works fine:
"terms"=>[
{"term"=>"40.0", "count"=>8},
{"term"=>"60.0", "count"=>6},
{"term"=>"60.7", "count"=>2},
{"term"=>"40.0", "count"=>2},
{"term"=>"60.6", "count"=>1},
{"term"=>"400.0", "count"=>1},
{"term"=>"40.5", "count"=>1}
]
But it takes very long time if i have a lot of records (
Can you help me please?
Thanks