Hi,
I want to query by a field that's not indexed. A script query should solve my question , query dsl as follows:
GET /_search
{
"query": {
"bool" : {
"must" : {
"script" : {
"script" : {
"source": "_source.num > 1",
"lang": "painless"
}
}
}
}
}
}
After sending request, I got a error "Variable [_source] is not defined". Need help.
fkelbert
(Florian Kelbert)
September 21, 2018, 3:29pm
2
Hi,
You might want to try:
{
"query": {
"bool" : {
"must" : {
"script" : {
"script" : {
"source": "doc['num'].value > 1",
"lang": "painless"
}
}
}
}
}
}
For further details, please see the documentation on script queries .
@fkelbert , the doc_values of field 'num' was disabled .So I could not use doc['num'].value
fkelbert
(Florian Kelbert)
September 23, 2018, 8:26pm
4
@wangqinghuan
Is your problem solved then? If not, what do you currently get? Also, what is the mapping of the field?
it's solved. I modify mapping to enable index and reindex indices.
system
(system)
Closed
October 22, 2018, 5:20am
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.