gisaia / ARLAS-server

Exploring & analyze collections of geo referenced data from your ElasticSearch cluster
Apache License 2.0
11 stars 0 forks source link

Return specific error code when ES does not support a feature #973

Closed alainbodiguel closed 2 months ago

alainbodiguel commented 3 months ago

If the license of ES does not allow a specific request, return a specific error code

alainbodiguel commented 3 months ago

Example of response for a geohex agg when license is not ok :

{
    "error": {
        "root_cause": [
            {
                "type": "security_exception",
                "reason": "current license is non-compliant for [geo-hex-agg]",
                "license.expired.feature": "geo-hex-agg"
            }
        ],
        "type": "security_exception",
        "reason": "current license is non-compliant for [geo-hex-agg]",
        "license.expired.feature": "geo-hex-agg"
    },
    "status": 403
}
alainbodiguel commented 3 months ago

Example of response for a geo_shape agg when license is not ok:

{
    "error": {
        "root_cause": [
            {
                "type": "security_exception",
                "reason": "current license is non-compliant for [geotile_grid aggregation on geo_shape fields]",
                "license.expired.feature": "geotile_grid aggregation on geo_shape fields"
            }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
            {
                "shard": 0,
                "index": "dataset",
                "node": "EK86XpXPRi2PNMcr9-beHg",
                "reason": {
                    "type": "security_exception",
                    "reason": "current license is non-compliant for [geotile_grid aggregation on geo_shape fields]",
                    "license.expired.feature": "geotile_grid aggregation on geo_shape fields"
                }
            }
        ]
    },
    "status": 403
}