Token count field type
Create a mapping with a token count field:
copy
Index three documents with text fields:
{ "sentence": "To be, or not to be: that is the question." }
copy
PUT testindex/_doc/3
{ "sentence": "Now is the winter of our discontent." }
copy
Search for sentences with fewer than 10 words:
The response contains one matching sentence:
{
"took" : 8,
"timed_out" : false,
"_shards" : {
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"relation" : "eq"
},
"max_score" : 1.0,
{
"_index" : "testindex",
"_type" : "_doc",
"_id" : "3",
"_score" : 1.0,
"_source" : {
"sentence" : "Now is the winter of our discontent."
}
}
]
}
Parameters
The following table lists the parameters accepted by token count field types. The analyzer
parameter is required; all other parameters are optional.