I have modified the mapping to add "_size" but I still can't get documents with certain field sizes .
basically I want to get all the documents where the "name" field is less than 4 chars
[elasticsearch@hadoop1 ~]$ curl -XGET "http://hadoop5:9200/sports/_mapping"?pretty
{
"sports" : {
"mappings" : {
"athlete" : {
"_size" : {
"enabled" : true
},
"properties" : {
"birthdate" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"location" : {
"type" : "geo_point"
},
"name" : {
"type" : "text",
"fielddata" : true
},
"rating" : {
"type" : "integer"
},
"sport" : {
"type" : "text"
}}}}}}
I have bunch of documents with name field populated as follows
"name" : "Ray"
"name" : "Mick"
the below query fails to find any documents where name is less than 5 characters.
curl -XGET 'http://hadoop5:9200/sports/_search?pretty' -d '
{
"query": {
"range": {
"_size": {
"lt": 5
}
}
}
}'{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
}
}