Closed
Description
If scripts_field is used, how can we get results of fields execution?
query{
profile(
opts: {
body: {
script_fields: {
results:{
script:{
lang: "painless"
inline: "Date n = new Date(); Date b = new Date(doc['birthday'].value); DateFormat f = new SimpleDateFormat('yyyy-MM-dd'); return Period.between(LocalDate.parse(f.format(b)), LocalDate.parse(f.format(n))).getYears();"
}
}
}
query: {
bool: {
must: {
term: {
systemId__keyword: {
value: "test-xxxxxx"
}
}
}
}
}
}
}
) {
took
count
hits {
_source {
fields {
results <--no hits.
}
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels