Hi @Ata_Zangene
The "_source" will always reflect the source document as it arrived for indexing, even if the fields are correct...
Fields are "indexed" and searched and aggregated against... the _source
is the source data.
Take a look at this and see if it helps
PUT discuss-test
{
"mappings": {
"properties": {
"coordinate": {
"properties": {
"geo": {
"type": "geo_point"
},
"latitude": {
"type": "float"
},
"longitude": {
"type": "float"
}
}
}
}
}
}
POST discuss-test/_doc
{
"coordinate": {
"geo": {
"lat": "55.86167039999999",
"lon": "-4.2583345"
},
"latitude": "55.86167039999999",
"longitude": "-4.2583345"
}
}
POST discuss-test/_doc
{
"coordinate": {
"geo": {
"lat": 55.86167039999999,
"lon": -4.2583345
},
"latitude": 55.86167039999999,
"longitude": -4.2583345
}
}
GET discuss-test/_search
{
"fields": ["*"]
}
# Result
# Notice the Fields are the right data types.
{
"took": 26,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "discuss-test",
"_id": "PYb75IwBy2LEDx_Ya9RU",
"_score": 1,
"_source": {
"coordinate": {
"geo": {
"lat": "55.86167039999999",
"lon": "-4.2583345"
},
"latitude": "55.86167039999999",
"longitude": "-4.2583345"
}
},
"fields": {
"coordinate.geo": [
{
"coordinates": [
-4.2583345,
55.86167039999999
],
"type": "Point"
}
],
"coordinate.longitude": [
-4.2583346
],
"coordinate.latitude": [
55.86167
]
}
},
{
"_index": "discuss-test",
"_id": "Pob75IwBy2LEDx_Ya9Rv",
"_score": 1,
"_source": {
"coordinate": {
"geo": {
"lat": 55.86167039999999,
"lon": -4.2583345
},
"latitude": 55.86167039999999,
"longitude": -4.2583345
}
},
"fields": {
"coordinate.geo": [
{
"coordinates": [
-4.2583345,
55.86167039999999
],
"type": "Point"
}
],
"coordinate.longitude": [
-4.2583346
],
"coordinate.latitude": [
55.86167
]
}
}
]
}
}