Search service does not ignore unmapped fields (records without spatial attributes are returned regardless)
The following request returns all records in that kinds I can access, but none of them actually has SpatialLocation attribute.
curl --location '<baseUrl>/search/v2/query' \
--header 'data-partition-id: partitionID' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data '{
"kind": "osdu:test:Hello:1.0.0",
"query": "*",
"spatialFilter": {
"field": "data.SpatialLocation.Wgs84Coordinates",
"byIntersection": {
"polygons": [
{
"points": [
{
"longitude": -180,
"latitude": 90
},
{
"longitude": 180,
"latitude": 90
},
{
"longitude": 180,
"latitude": -90
},
{
"longitude": -180,
"latitude": -90
},
{
"longitude": -180,
"latitude": 90
}
]
}
]
}
}
}'
However, the following request returns 0 record which is expected.
curl --location '<baseUrl>/search/v2/query' \
--header 'data-partition-id: partitionID' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data '{
"kind": "osdu:test:Hello:1.0.0",
"query": "_exists_:data.SpatialLocation"
}'
Fix: Ignore Unmapped fields in Elastic Search
Edited by An Ngo