quickwit-oss / quickwit-datasource

Quickwit data source for Grafana
GNU Affero General Public License v3.0
41 stars 10 forks source link

Issue #20: add dynamic fields #41

Closed idrissneumann closed 8 months ago

idrissneumann commented 8 months ago

@fmassot At this stage, seems working:

Screenshot 2023-12-27 at 20 27 12

I add a filter on aggregatable: true and the update the typeMap with the types defined in the elasticsearch documentation which are corresponding to the types returned by the /_field_caps endpoint:

$ curl http://localhost:7280/api/v1/_elastic/yoi/_field_caps
{
  "indices": [
    "yoi"
  ],
  "fields": {
    "timestamp": {
      "date_nanos": {
        "metadata_field": false,
        "searchable": true,
        "aggregatable": true,
        "type": "date_nanos",
        "indices": [
          "yoi"
        ]
      }
    },
    "yo": {
      "text": {
        "metadata_field": false,
        "searchable": true,
        "aggregatable": false,
        "type": "text",
        "indices": [
          "yoi"
        ]
      },
      "keyword": {
        "metadata_field": false,
        "searchable": true,
        "aggregatable": false,
        "type": "keyword",
        "indices": [
          "yoi"
        ]
      }
    },
    "_field_presence": {
      "long": {
        "metadata_field": false,
        "searchable": true,
        "aggregatable": false,
        "type": "long",
        "indices": [
          "yoi"
        ]
      }
    }
  }
}
fmassot commented 8 months ago

@idrissneumann I declared explicit types for field capabilities, can you check my last modifications?

idrissneumann commented 8 months ago

@idrissneumann I declared explicit types for field capabilities, can you check my last modifications?

Yeah, nice refactoring, it's a better version with explicit types for sure.

I made two changes:

The tests are still ok though so LGTM for me :)