Token count query and its correlation with field


I have a mapping as below. The text field below is actually an array of different values of different word length.

"docs": {
"mappings": {
"doc": {
"properties": {
"name": {
"type": "text",
"fields": {
"length": {
"type": "token_count",
"analyzer": "standard"

If i have many values in the "name" array, i have multiple "length" values generated by token_count field.

On querying with name="John Walker" and name.length=3, it still gives results. That is because there is another name called "Bishop Rook Knight" in it.

How do i maintain correlation between name and length ?

(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.