Skip to content

"fields" API return a text instead of a number for a numeric sub-field #61033

@astefan

Description

@astefan

Mapping:

{
	"mappings": {
	  "properties": {
           "text_field": {
             "type": "text",
             "fields": {
               "integer_subfield": {
                 "type": "integer"
               }
             }
           },
           "integer_field": {
             "type": "integer"
           }
	  }
	}
}

Test data:

{"index":{}}
{"text_field": "-1914753919", "integer_field": "-1914753919"}
{"index":{}}
{"text_field": 1914753919, "integer_field": 1914753919}
{"index":{}}
{"text_field": "1914753919", "integer_field": "1914753919"}

The output of text_field.integer_subfield should be a number, just like the output of integer_field, instead it's being returned as a String:

        "hits": [
            {
                "_index": "test",
                "_id": "DtoI43MBMAxUDNMNyqcY",
                "_score": 1,
                "fields": {
                    "text_field.integer_subfield": [
                        "-1914753919"
                    ],
                    "integer_field": [
                        -1914753919
                    ],
                    "text_field": [
                        "-1914753919"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "D9oI43MBMAxUDNMNyqcZ",
                "_score": 1,
                "fields": {
                    "text_field.integer_subfield": [
                        "1914753919"
                    ],
                    "integer_field": [
                        1914753919
                    ],
                    "text_field": [
                        "1914753919"
                    ]
                }
            },
            {
                "_index": "test",
                "_id": "ENoI43MBMAxUDNMNyqcZ",
                "_score": 1,
                "fields": {
                    "text_field.integer_subfield": [
                        "1914753919"
                    ],
                    "integer_field": [
                        1914753919
                    ],
                    "text_field": [
                        "1914753919"
                    ]
                }
            }
        ]

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bugTeam:SearchMeta label for search team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions