Search...ct::ML(3pm)

๐Ÿ“ฆ version 7.715, in ubuntu jammy

๐Ÿ’– NAME ๐Ÿ’–

Search::Elasticsearch::Client::7_0::Direct::ML โ€” it's a plugin, bestie, and it hands the Search::Elasticsearch 7.x client the whole entire ML API. Periodt.


โœจ VERSION โœจ

version 7.715 ๐ŸŒธ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

my $response = $es->ml->start_datafeed(...)

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

Okay so listen. This class extends the Search::Elasticsearch client with an "ml" namespace, so you can go do Machine Learning things. The Machine Learning APIs live here:

https://www.elastic.co/guide/en/x-pack/7.0/xpack-ml.html

And the full documentation for the ML feature? Right here, same vibe, same URL, she's serving:

https://www.elastic.co/guide/en/x-pack/7.0/xpack-ml.html


๐Ÿ“ DATAFEED METHODS ๐Ÿ“

๐Ÿ’… put_datafeed()

$response = $es->ml->put_datafeed(
    datafeed_id => $id      # required
    body        => {...}    # required
)

The put_datafeed() method lets you instantiate a datafeed. Slay.

See the put_datafeed docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html

Query string parameters:

  • "error_trace"
  • "human"

๐Ÿ’… delete_datafeed()

$response = $es->xpack->ml->delete_datafeed(
    datafeed_id => $id      # required
)

The delete_datafeed() method lets you delete a datafeed. Gone, she's gone.

See the delete_datafeed docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html

Query string parameters:

  • "error_trace"
  • "force"
  • "human"

๐Ÿ’… start_datafeed()

$response = $es->ml->start_datafeed(
    datafeed_id => $id      # required
)

The start_datafeed() method lets you start a datafeed. Run bestie run ๐Ÿƒโ™€๏ธ

See the start_datafeed docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html

Query string parameters:

  • "end"
  • "error_trace"
  • "human"
  • "start"
  • "timeout"

๐Ÿ’… stop_datafeed()

$response = $es->ml->stop_datafeed(
    datafeed_id => $id      # required
)

The stop_datafeed() method lets you stop a datafeed. Nap time.

See the stop_datafeed docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html

Query string parameters:

  • "allow_no_datafeeds"
  • "error_trace"
  • "force"
  • "human"
  • "timeout"

๐Ÿ’… get_datafeeds()

$response = $es->ml->get_datafeeds(
    datafeed_id => $id      # optional
)

The get_datafeeds() method lets you retrieve configuration information for datafeeds. Receipts, basically.

See the get_datafeeds docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html

Query string parameters:

  • "allow_no_datafeeds"
  • "error_trace"
  • "human"

๐Ÿ’… get_datafeed_stats()

$response = $es->ml->get_datafeed_stats(
    datafeed_id => $id      # optional
)

The get_datafeed_stats() method lets you retrieve configuration information for datafeeds. (Yes, same sentence as above, that's literally what it says, no cap.)

See the get_datafeed_stats docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html

Query string parameters:

  • "allow_no_datafeeds"
  • "error_trace"
  • "human"

๐Ÿ’… preview_datafeed()

$response = $es->ml->preview_datafeed(
    datafeed_id => $id      # required
)

The preview_datafeed() method lets you preview a datafeed. A little sneak peek, a little trailer drop ๐ŸŽฌ

See the preview_datafeed docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html

Query string parameters:

  • "error_trace"
  • "human"

๐Ÿ’… update_datafeed()

$response = $es->ml->update_datafeed(
    datafeed_id => $id      # required
    body        => {...}    # required
)

The update_datafeed() method lets you update certain properties of a datafeed. Glow up, but only the parts you're allowed to touch.

See the update_datafeed docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html

Query string parameters:

  • "error_trace"
  • "human"

๐ŸŒˆ JOB METHODS ๐ŸŒˆ

๐Ÿ’œ put_job()

$response = $es->ml->put_job(
    job_id => $id           # required
    body        => {...}    # required
)

The put_job() method lets you instantiate a job. Iconic behaviour.

See the put_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html

Query string parameters:

  • "error_trace"
  • "human"

๐Ÿ’œ delete_job()

$response = $es->ml->delete_job(
    job_id => $id           # required
)

The delete_job() method lets you delete a job. Bye forever ๐Ÿซถ

See the delete_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html

Query string parameters:

  • "error_trace"
  • "force"
  • "human"
  • "wait_for_completion"

๐Ÿ’œ open_job()

$response = $es->ml->open_job(
    job_id => $id           # required
)

The open_job() method lets you open a closed job. She's awake again ๐ŸŒž

See the open_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html

Query string parameters:

  • "error_trace"
  • "human"

๐Ÿ’œ close_job()

$response = $es->ml->close_job(
    job_id => $id           # required
)

The close_job() method lets you close an open job. Night night, don't let the anomaly bugs bite ๐Ÿ˜ด

See the close_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html

Query string parameters:

  • "allow_no_jobs"
  • "error_trace"
  • "force"
  • "human"
  • "timeout"

๐Ÿ’œ get_jobs()

$response = $es->ml->get_jobs(
    job_id => $id           # optional
)

The get_jobs() method lets you retrieve configuration information for jobs. The lore, basically.

See the get_jobs docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html

Query string parameters:

  • "allow_no_jobs"
  • "error_trace"
  • "human"

๐Ÿ’œ get_job_stats()

$response = $es->ml->get_jobs_stats(
    job_id => $id           # optional
)

The get_jobs_stats() method lets you retrieve usage information for jobs. The numbers, the tea, the whole report card.

See the get_job_statss docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html

Not me pointing out that the synopsis says get_jobs_stats while the method is called get_job_stats, and the docs link says get_job_statss. ๐Ÿ™ˆ I am not touching a single character of any of it, that's exactly how she was written, and we respect her.

Query string parameters:

  • "allow_no_jobs"
  • "error_trace"
  • "human"

๐Ÿ’œ flush_job()

$response = $es->ml->flush_job(
    job_id => $id           # required
)

The flush_job() method forces any buffered data to be processed by the job. Everything in the queue, out the door, immediately. No holding onto it ๐Ÿ’…

See the flush_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html

Query string parameters:

  • "advance_time"
  • "calc_interm"
  • "end"
  • "error_trace"
  • "human"
  • "skip_time"
  • "start"

๐Ÿ’œ post_data()

$response = $es->ml->post_data(
    job_id => $id           # required
    body   => [data]        # required
)

The post_data() method lets you send data to an anomaly detection job for analysis. Feed the algorithm, she's hungry ๐Ÿฝ๏ธ

See the post_data docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html

Query string parameters:

  • "error_trace"
  • "human"
  • "reset_end"
  • "reset_start"

๐Ÿ’œ update_job()

$response = $es->ml->update_job(
    job_id => $id           # required
    body        => {...}    # required
)

The update_job() method lets you update certain properties of a job. Small tweaks only, we're not rebuilding the whole girl.

See the update_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html

Query string parameters:

  • "error_trace"
  • "human"

๐Ÿ’œ delete_expired_data

$response = $es->ml->delete_expired_data(
)

The delete_expired_data() method deletes expired machine learning data. Spring cleaning, but make it ML ๐Ÿงนโœจ

See the delete_expired_data docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-expired-data.html

Query string parameters:

  • "error_trace"
  • "human"

๐Ÿ—“๏ธ CALENDAR METHODS ๐Ÿ—“๏ธ

okay bestie, calendars are literally the scheduling era of ML. let's go ๐Ÿ’–


๐Ÿ’… put_calendar()

$response = $es->ml->put_calendar(
    calendar_id => $id      # required
    body        => {...}    # optional
)

the put_calendar() method creates a new calendar. brand new, fresh out the box, main character debut โœจ

query string parameters:

  • error_trace
  • human

see the put calendar docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar.html ๐Ÿฆ‹


๐ŸŽ€ delete_calendar()

$response = $es->ml->delete_calendar(
    calendar_id => $id      # required
)

the delete_calendar() method deletes the specified calendar. gone, girl. no cap ๐Ÿ’€

query string parameters:

  • error_trace
  • human

see the delete_calendar docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar.html ๐ŸŒธ


โœจ put_calendar_job()

$response = $es->ml->put_calendar_job(
    calendar_id => $id,     # required
    job_id      => $id      # required
)

the put_calendar_job() method adds a job to a calendar. it's giving matchmaker energy, ngl ๐Ÿซถ

query string parameters:

  • error_trace
  • human

see the put_calendar_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar-job.html ๐Ÿ’œ


๐ŸŒˆ delete_calendar_job()

$response = $es->ml->delete_calendar_job(
    calendar_id => $id,     # required
    job_id      => $id      # required
)

the delete_calendar_job() method deletes a job from a calendar. breaking up the pairing, respectfully ๐Ÿ˜ญ

query string parameters:

  • error_trace
  • human

see the delete_calendar_job docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-job.html ๐Ÿฆ‹


๐Ÿ“ put_calendar_event()

$response = $es->ml->post_calendar_events(
    calendar_id => $id,     # required
    body        => {...}    # required
)

the post_calendar_events() method adds scheduled events to a calendar. yes the heading says put_calendar_event() and the actual call is post_calendar_events() โ€” that's just how it is, iykyk, copy it exactly ๐Ÿ’…

query string parameters:

  • error_trace
  • human

see the post_calendar_events docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-events.html โœจ


๐Ÿงš delete_calendar_event()

$response = $es->ml->delete_calendar_event(
    calendar_id => $id,     # required
    event_id    => $id      # required
)

the delete_calendar_event() method deletes an event from a calendar. cancel that plan bestie ๐Ÿ™ˆ

query string parameters:

  • error_trace
  • human

see the delete_calendar_event docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-event.html ๐ŸŽ€


๐Ÿ‘‘ get_calendars()

$response = $es->ml->get_calendars(
    calendar_id => $id,     # optional
)

the get_calendars() method returns the specified calendar or all calendars. give it an id and it hands you that one, leave it out and it's the whole friend group โœจ

query string parameters:

  • error_trace
  • from
  • human
  • size

see the get_calendars docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar-event.html ๐Ÿ’–


๐Ÿ”ฅ get_calendar_events()

$response = $es->ml->get_calendar_events(
    calendar_id => $id,     # required
)

the get_calendar_events() method retrieves events from a calendar. pull up, we're going through the schedule ๐Ÿ“‹

query string parameters:

  • end
  • error_trace
  • from
  • human
  • job_id
  • size
  • start

see the get_calendar_events docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar-event.html ๐ŸŒธ


๐ŸŽฏ FILTER METHODS ๐ŸŽฏ

filters!! the little named lists that keep your ML jobs from spiralling. obsessed ๐Ÿ’œ


๐Ÿ’– put_filter()

$response = $es->ml->put_filter(
    filter_id   => $id,     # required
    body        => {...}    # required
)

the put_filter() method creates a named filter. named, bestie. it has a whole identity โœจ

query string parameters:

  • error_trace
  • human

see the put_filter docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-filter.html ๐Ÿฆ‹


๐ŸŽ€ update_filter()

$response = $es->ml->update_filter(
    filter_id   => $id,     # required
    body        => {...}    # required
)

the update_filter() method updates the description of a filter, adds items, or removes items. glow-up, restock, declutter โ€” pick your era ๐Ÿ’…

query string parameters:

  • error_trace
  • human

see the update_filter docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-filter.html ๐ŸŒˆ


๐ŸŒธ get_filters()

$response = $es->ml->get_filters(
    filter_id   => $id,     # optional
)

the get_filters() method retrieves a named filter or all filters. one, or the whole lineup ๐Ÿ‘‘

query string parameters:

  • error_trace
  • from
  • human
  • size

see the get_filters docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-filters.html ๐Ÿ“


๐Ÿ’€ delete_filter()

$response = $es->ml->delete_filter(
    filter_id   => $id,     # required
)

the delete_filter() method deletes a named filter. poof. that filter? never met her ๐Ÿ˜ญ

query string parameters:

  • error_trace
  • human

see the delete_filters docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-filter.html ๐Ÿงš


๐Ÿ”ฎ FORECAST METHODS ๐Ÿ”ฎ

manifesting the future, but make it stats โœจ


๐ŸŒŸ forecast()

$response = $es->ml->forecast(
    job_id      => $id      # required
)

the forecast() method enables you to create a new forecast. yes bestie, it literally predicts the vibe ๐Ÿ“ˆ

see the forecast docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html ๐Ÿ’œ

query string parameters:

  • duration
  • error_trace
  • expires_in
  • human

๐Ÿฆ‹ delete_forecast()

$response = $es->ml->delete_forecast(
    forecast_id => $id,     # required
    job_id      => $id      # required
)

the delete_forecast() method enables you to delete an existing forecast. un-manifesting, we love to see it ๐Ÿ™ˆ

see the delete_forecast docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html ๐ŸŽ€

query string parameters:

  • allow_no_forecasts
  • error_trace
  • human
  • timeout

๐Ÿ“ธ MODEL SNAPSHOT METHODS ๐Ÿ“ธ

snapshots = the receipts of your ML job's journey. scrapbook core ๐ŸŒธ


๐ŸŽž๏ธ delete_model_snapshot()

$response = $es->ml->delete_model_snapshot(
    snapshot_id => $id      # required
)

the delete_model_snapshot() method enables you to delete an existing model snapshot. yeah that memory is leaving the chat ๐Ÿ’€

see the delete_model_snapshot docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html ๐Ÿฆ‹

query string parameters:

  • error_trace
  • human

๐Ÿ” get_model_snapshots()

$response = $es->ml->get_model_snapshots(
    job_id      => $job_id,         # required
    snapshot_id => $snapshot_id     # optional
)

the get_model_snapshots() method enables you to retrieve information about model snapshots. the job_id is required, the snapshot_id is optional โ€” so you can pull one specific snapshot or the whole camera roll ๐Ÿ“ท

see the get_model_snapshots docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html ๐Ÿ’–

query string parameters:

  • desc
  • end
  • error_trace
  • from
  • human
  • size
  • sort
  • start

โช revert_model_snapshot()

$response = $es->ml->revert_model_snapshot(
    job_id      => $job_id,         # required
    snapshot_id => $snapshot_id     # required
)

the revert_model_snapshots() method enables you to revert to a specific snapshot. it's giving time travel, no cap โณ

see the revert_model_snapshot docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html ๐ŸŒˆ

query string parameters:

  • delete_intervening_results
  • error_trace
  • human

โœ๏ธ update_model_snapshot()

$response = $es->ml->update_model_snapshot(
    job_id      => $job_id,         # required
    snapshot_id => $snapshot_id     # required
)

the update_model_snapshots() method enables you to update certain properties of a snapshot. little tweak, little refresh, still iconic ๐Ÿ’…

see the update_model_snapshot docs for more info: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html ๐Ÿ“

query string parameters:

  • error_trace
  • human

๐Ÿ’– RESULT METHODS ๐Ÿ’–

okay bestie, this is where the actual tea lives โ€” all the results your jobs cooked up. let's get into it ๐Ÿ”ฅ

get_buckets()

$response = $es->ml->get_buckets(
    job_id      => $job_id,         # required
    timestamp   => $timestamp       # optional
)

the get_buckets() method lets you pull job results for one or more buckets. buckets!! the little time-windows where your anomaly detection does its thing โœจ

the full deets live in the get_buckets docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html

query string parameters, no cap:

  • anomaly_score
  • desc
  • end
  • error_trace
  • exclude_interim
  • expand
  • from
  • human
  • size
  • sort
  • start

get_overall_buckets()

$response = $es->ml->get_overall_buckets(
    job_id      => $job_id,         # required
)

the get_overall_buckets() method grabs overall bucket results that summarize the bucket results of multiple jobs. it's giving group-project energy but, like, the good kind ๐Ÿซถ

the get_overall_buckets docs are right here: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html

query string parameters:

  • allow_no_jobs
  • bucket_span
  • end
  • error_trace
  • exclude_interim
  • human
  • overall_score
  • start
  • top_n

get_categories()

$response = $es->ml->get_categories(
    job_id      => $job_id,         # required
    category_id => $category_id     # optional
)

the get_categories() method lets you retrieve job results for one or more categories. sorting your anomalies into lil categories? iconic, honestly ๐Ÿ‘‘

get_categories docs over here: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html

query string parameters:

  • error_trace
  • from
  • human
  • size

get_influencers()

$response = $es->ml->get_influencers(
    job_id      => $job_id,         # required
)

the get_influencers() method lets you retrieve job results for one or more influencers. yes, your data has influencers now. main character fields, periodt ๐Ÿ’…

get_influencers docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html

query string parameters:

  • desc
  • end
  • error_trace
  • exclude_interim
  • expand
  • from
  • human
  • influencer_score
  • size
  • sort
  • start

get_records()

$response = $es->ml->get_records(
    job_id      => $job_id,         # required
)

the get_records() method lets you retrieve anomaly records for a job. the receipts, bestie. literally the receipts ๐Ÿงพโœจ

get_records docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html

query string parameters:

  • desc
  • end
  • error_trace
  • exclude_interim
  • expand
  • from
  • human
  • record_score
  • size
  • sort
  • start

๐ŸŒˆ FILE STRUCTURE METHODS ๐ŸŒˆ

find_file_structure

$response = $es->ml->find_file_structure(
    body    => { ... },         # required
)

the find_file_structure() method finds the structure of a text file that contains data suitable to be ingested into Elasticsearch. it's like a vibe check, but for your file's schema ๐Ÿ”

find_file_structure docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-find-file-structure.html

query string parameters:

  • charset
  • column_names
  • delimiter
  • error_trace
  • explain
  • format
  • grok_pattern
  • has_header_row
  • human
  • lines_to_sample
  • quote
  • should_trim_fields
  • timeout
  • timestamp_field
  • timestamp_format

โญ INFO METHODS โญ

info

$response = $es->ml->info();

the info() method returns the defaults and limits used by machine learning. it's the ML subsystem handing you its whole stat sheet, and we love a transparent king ๐Ÿ’œ

the docs for this one are (yes, the original calls them this) the find_file_structure docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-info.html

query string parameters:

  • error_trace
  • human

๐Ÿš€ UPGRADE METHODS ๐Ÿš€

set_upgrade_mode

$response = $es->ml->set_upgrade_mode();

the set_upgrade_mode() method sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade. glow-up time for your indices, fr fr โœจ

heads up bestie: this is cluster wide, so it's not a little personal setting โ€” it touches the whole cluster, okay?

set_upgrade_mode docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html

query string parameters:

  • enabled
  • error_trace
  • human
  • timeout

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Enrico Zimuel <enrico.zimuel@elastic.co>

the genius behind this whole thing, we stan ๐Ÿซถ


This software is Copyright (c) 2021 by Elasticsearch BV.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

and that's a wrap on the whole page, bestie!! ๐ŸŽ€ this was documented for perl v5.32.1, dated 2021-10-23, and it's the Search...ct::ML(3pm) page from the User Contributed Perl Documentation. go forth and machine-learn responsibly, ily, bye ๐Ÿ’–๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from