fox-it / flow.record

Recordization library
GNU Affero General Public License v3.0
7 stars 9 forks source link

Add metadata fields to elastic adapter #121

Closed JSCU-CNI closed 3 months ago

JSCU-CNI commented 4 months ago

This PR adds metadata fields to the elastic adapter and repairs elastic+[PROTOCOL]:// behaviour. It also enables users to authenticate to Elasticsearch with an API key.

You can now write arbitrary metadata to the document._source._record_metadata dict using the following syntax:

rdump -w "elastic+https://localhost:9200?_meta_foo=bar"

This will result in the following _record_metadata dict:

{
    ...
    "foo": "bar"
}

Of course we can change _meta_ to something else if that seems more appropriate for the flow.record project.

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 76.92308% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 83.67%. Comparing base (e0586ef) to head (cd99f9b).

Files Patch % Lines
flow/record/adapter/elastic.py 76.92% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #121 +/- ## ========================================== + Coverage 81.94% 83.67% +1.72% ========================================== Files 34 34 Lines 3385 3394 +9 ========================================== + Hits 2774 2840 +66 + Misses 611 554 -57 ``` | [Flag](https://app.codecov.io/gh/fox-it/flow.record/pull/121/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fox-it) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/fox-it/flow.record/pull/121/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fox-it) | `83.67% <76.92%> (+1.72%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=fox-it#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.