I am currently using ES version 0.19. For a feature requirement, I wanted
to execute script on missing field through terms facet. The curl which I
tried is something like below
{
"query": {
"term": {
"content": "deep"
}
},
"filter": {
"and": {
"filters": [
{
"type": {
"value": "twitter"
}
}
]
}
},
"facets": {
"loca": {
"terms": {
"field": "countryid",
"script": "doc['countryid']==null?1:doc['countryid'].value"
}
}
}
}
I assume that missing fields can be accessed by the condition
doc['countryid']==null. But it looks like this is not the way to identify
the missing field in script
For which am always receiving response as missing
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 6,
"successful" : 6,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
},
"facets" : {
"loca" : {
"_type" : "terms",
"missing" : 1,
"total" : 0,
"other" : 0,
"terms" : [ ]
}
}
}
Could anybody help me to get this correct.
Thanks in advance, Manoj
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/aaccc328-e7c1-4268-a8b9-585d16e7cecb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.