Hello everyone,
I use the 'query_string' command to count members, where I want to limit the results to only those documents where the length in the 'membIdentificNumb' field is exactly 7 characters.
I entered the following command in Kibana:
GET transakcije_2y/_search
{
"size": 0,
"query": {
"bool": {
"filter": {
"query_string": {
"query": "date:[2019-01-01 TO 2019-12-31] AND (type: (41) OR type:(47)) AND acronym: (CTK) **AND (LENGTH(membIdentificNumb)==7)**",
"time_zone": "Europe/Ljubljana"
}
}
}
},
"aggs": {
"by_membIdentificNumb": {
"terms": {
"field": "membIdentificNumb",
"size": 100,
"order": {
"_key": "asc"
}
}
}
}
}
and got a reply:
{
"took" : 1679,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 525,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"by_membIdentificNumb" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" : [
{
"key" : "**0004798**",
"doc_count" : 14
},
{
"key" : "**990000006**",
"doc_count" : 13
},
...
Why does query not respect the result limits on members with a length of 7? It should find only the first, which has a length of 7, and the others eliminated. The field 'membIdentificNumb' is full text.
It looks like the LENGTH function does not affect the result. If e.g. changing to (LENGTH (membIdentificNumb) == 1) returns the same result.
Thanks for any help
Tinko