INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
The Cluster Stats API allows to retrieve statistics from a cluster wide perspective. The API returns basic index metrics and information about the current nodes that form the cluster. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ cluster - stats. html > _ | def stats(self, node_id=None, params=None):
"""
The Cluster Stats API allows to retrieve statistics from a cluster wide
perspective. The API returns basic index metrics and information about
the current nodes that form the cluster.
`<http://www.elastic.co/guide/en/elasticsearch/r... |
Explicitly execute a cluster reroute allocation command including specific commands. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ cluster - reroute. html > _ | def reroute(self, body=None, params=None):
"""
Explicitly execute a cluster reroute allocation command including specific commands.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-reroute.html>`_
:arg body: The definition of `commands` to perform (`move`, `cance... |
Update cluster wide specific settings. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ cluster - update - settings. html > _ | def put_settings(self, body=None, params=None):
"""
Update cluster wide specific settings.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html>`_
:arg body: The settings to be updated. Can be either `transient` or
`persistent` (survi... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ cluster - allocation - explain. html > _ | def allocation_explain(self, body=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-allocation-explain.html>`_
:arg body: The index, shard, and primary flag to explain. Empty means
'explain the first unassigned shard'
:arg inclu... |
<http:// www. elastic. co/ guide/ en/ migration/ current/ migration - api - deprecation. html > _ | def deprecations(self, index=None, params=None):
"""
`<http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html>`_
:arg index: Index pattern
"""
return self.transport.perform_request(
"GET", _make_path(index, "_migration", "deprecations"), para... |
Return a connection from the pool using the ConnectionSelector instance. | def get_connection(self):
"""
Return a connection from the pool using the `ConnectionSelector`
instance.
It tries to resurrect eligible connections, forces a resurrection when
no connections are availible and passes the list of live connections to
the selector instance t... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ccr - put - follow. html > _ | def follow(self, index, body, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html>`_
:arg index: The name of the follower index
:arg body: The name of the leader index and other optional ccr related
parameters
:arg ... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ccr - get - follow - info. html > _ | def follow_info(self, index=None, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html>`_
:arg index: A comma-separated list of index patterns; use `_all` to
perform the operation on all indices
"""
return self.... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ccr - get - follow - stats. html > _ | def follow_stats(self, index, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html>`_
:arg index: A comma-separated list of index patterns; use `_all` to
perform the operation on all indices
"""
if index in SKI... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ccr - get - auto - follow - pattern. html > _ | def get_auto_follow_pattern(self, name=None, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html>`_
:arg name: The name of the auto follow pattern.
"""
return self.transport.perform_request(
"GET", _mak... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ccr - put - auto - follow - pattern. html > _ | def put_auto_follow_pattern(self, name, body, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html>`_
:arg name: The name of the auto follow pattern.
:arg body: The specification of the auto follow pattern
"""
... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ccr - post - resume - follow. html > _ | def resume_follow(self, index, body=None, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html>`_
:arg index: The name of the follow index to resume following.
:arg body: The name of the leader index and other optional ccr relat... |
<https:// www. elastic. co/ guide/ en/ elasticsearch/ plugins/ current/ ingest. html > _ | def get_pipeline(self, id=None, params=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest.html>`_
:arg id: Comma separated list of pipeline ids. Wildcards supported
:arg master_timeout: Explicit operation timeout for connection to master
node
... |
< > _ | def delete_calendar_event(self, calendar_id, event_id, params=None):
"""
`<>`_
:arg calendar_id: The ID of the calendar to modify
:arg event_id: The ID of the event to remove from the calendar
"""
for param in (calendar_id, event_id):
if param in SKIP_IN_PATH... |
< > _ | def delete_filter(self, filter_id, params=None):
"""
`<>`_
:arg filter_id: The ID of the filter to delete
"""
if filter_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'filter_id'.")
return self.transport.perform_request(
... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - delete - forecast. html > _ | def delete_forecast(self, job_id, forecast_id=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html>`_
:arg job_id: The ID of the job from which to delete forecasts
:arg forecast_id: The ID of the forecast to delete, can be comm... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - delete - job. html > _ | def delete_job(self, job_id, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html>`_
:arg job_id: The ID of the job to delete
:arg force: True if the job should be forcefully deleted, default False
:arg wait_for_completion: Should... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - delete - snapshot. html > _ | def delete_model_snapshot(self, job_id, snapshot_id, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html>`_
:arg job_id: The ID of the job to fetch
:arg snapshot_id: The ID of the snapshot to delete
"""
for param in ... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - file - structure. html > _ | def find_file_structure(self, body, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure.html>`_
:arg body: The contents of the file to be analyzed
:arg charset: Optional parameter to specify the character set of the
file
... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - flush - job. html > _ | def flush_job(self, job_id, body=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html>`_
:arg job_id: The name of the job to flush
:arg body: Flush parameters
:arg advance_time: Advances time to the given value generating res... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - bucket. html > _ | def get_buckets(self, job_id, timestamp=None, body=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html>`_
:arg job_id: ID of the job to get bucket results from
:arg timestamp: The timestamp of the desired single bucket result
... |
< > _ | def get_calendar_events(self, calendar_id, params=None):
"""
`<>`_
:arg calendar_id: The ID of the calendar containing the events
:arg end: Get events before this time
:arg from_: Skips a number of events
:arg job_id: Get events for the job. When this option is used
... |
< > _ | def get_calendars(self, calendar_id=None, body=None, params=None):
"""
`<>`_
:arg calendar_id: The ID of the calendar to fetch
:arg body: The from and size parameters optionally sent in the body
:arg from_: skips a number of calendars
:arg size: specifies a max number of... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - category. html > _ | def get_categories(self, job_id, category_id=None, body=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html>`_
:arg job_id: The name of the job
:arg category_id: The identifier of the category definition of interest
:arg ... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - datafeed - stats. html > _ | def get_datafeed_stats(self, datafeed_id=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html>`_
:arg datafeed_id: The ID of the datafeeds stats to fetch
:arg allow_no_datafeeds: Whether to ignore if a wildcard expression
... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - datafeed. html > _ | def get_datafeeds(self, datafeed_id=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html>`_
:arg datafeed_id: The ID of the datafeeds to fetch
:arg allow_no_datafeeds: Whether to ignore if a wildcard expression
matches... |
< > _ | def get_filters(self, filter_id=None, params=None):
"""
`<>`_
:arg filter_id: The ID of the filter to fetch
:arg from_: skips a number of filters
:arg size: specifies a max number of filters to get
"""
return self.transport.perform_request(
"GET", _ma... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - job - stats. html > _ | def get_job_stats(self, job_id=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html>`_
:arg job_id: The ID of the jobs stats to fetch
:arg allow_no_jobs: Whether to ignore if a wildcard expression matches
no jobs. (Th... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - job. html > _ | def get_jobs(self, job_id=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html>`_
:arg job_id: The ID of the jobs to fetch
:arg allow_no_jobs: Whether to ignore if a wildcard expression matches
no jobs. (This includes `_all... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - get - snapshot. html > _ | def get_model_snapshots(self, job_id, snapshot_id=None, body=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html>`_
:arg job_id: The ID of the job to fetch
:arg snapshot_id: The ID of the snapshot to fetch
:arg body: Mode... |
< > _ | def post_calendar_events(self, calendar_id, body, params=None):
"""
`<>`_
:arg calendar_id: The ID of the calendar to modify
:arg body: A list of events
"""
for param in (calendar_id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty va... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - post - data. html > _ | def post_data(self, job_id, body, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html>`_
:arg job_id: The name of the job receiving the data
:arg body: The data to process
:arg reset_end: Optional parameter to specify the end of t... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - preview - datafeed. html > _ | def preview_datafeed(self, datafeed_id, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html>`_
:arg datafeed_id: The ID of the datafeed to preview
"""
if datafeed_id in SKIP_IN_PATH:
raise ValueError(
... |
< > _ | def put_calendar(self, calendar_id, body=None, params=None):
"""
`<>`_
:arg calendar_id: The ID of the calendar to create
:arg body: The calendar details
"""
if calendar_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required ... |
< > _ | def put_calendar_job(self, calendar_id, job_id, params=None):
"""
`<>`_
:arg calendar_id: The ID of the calendar to modify
:arg job_id: The ID of the job to add to the calendar
"""
for param in (calendar_id, job_id):
if param in SKIP_IN_PATH:
... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - start - datafeed. html > _ | def start_datafeed(self, datafeed_id, body=None, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html>`_
:arg datafeed_id: The ID of the datafeed to start
:arg body: The start datafeed parameters
:arg end: The end time when th... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - update - datafeed. html > _ | def update_datafeed(self, datafeed_id, body, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html>`_
:arg datafeed_id: The ID of the datafeed to update
:arg body: The datafeed update settings
"""
for param in (datafee... |
< > _ | def update_filter(self, filter_id, body, params=None):
"""
`<>`_
:arg filter_id: The ID of the filter to update
:arg body: The filter update
"""
for param in (filter_id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for... |
<http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ ml - update - snapshot. html > _ | def update_model_snapshot(self, job_id, snapshot_id, body, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html>`_
:arg job_id: The ID of the job to fetch
:arg snapshot_id: The ID of the snapshot to update
:arg body: The mode... |
< > _ | def validate(self, body, params=None):
"""
`<>`_
:arg body: The job config
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST", "/_ml/anomaly_detectors/_... |
< > _ | def validate_detector(self, body, params=None):
"""
`<>`_
:arg body: The detector
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST",
"/_ml/... |
Perform the analysis process on a text and return the tokens breakdown of the text. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - analyze. html > _ | def analyze(self, index=None, body=None, params=None):
"""
Perform the analysis process on a text and return the tokens breakdown of the text.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html>`_
:arg index: The name of the index to scope the operatio... |
Explicitly refresh one or more index making all operations performed since the last refresh available for search. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - refresh. html > _ | def refresh(self, index=None, params=None):
"""
Explicitly refresh one or more index, making all operations performed
since the last refresh available for search.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html>`_
:arg index: A comma-separat... |
Explicitly flush one or more indices. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - flush. html > _ | def flush(self, index=None, params=None):
"""
Explicitly flush one or more indices.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html>`_
:arg index: A comma-separated list of index names; use `_all` or empty
string for all indices
:a... |
The get index API allows to retrieve information about one or more indexes. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - get - index. html > _ | def get(self, index, feature=None, params=None):
"""
The get index API allows to retrieve information about one or more indexes.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html>`_
:arg index: A comma-separated list of index names
:arg allo... |
Check if a type/ types exists in an index/ indices. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - types - exists. html > _ | def exists_type(self, index, doc_type, params=None):
"""
Check if a type/types exists in an index/indices.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html>`_
:arg index: A comma-separated list of index names; use `_all` to check
the... |
Retrieve mapping definition of index or index/ type. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - get - mapping. html > _ | def get_mapping(self, index=None, doc_type=None, params=None):
"""
Retrieve mapping definition of index or index/type.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html>`_
:arg index: A comma-separated list of index names
:arg doc_type: A ... |
Retrieve mapping definition of a specific field. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - get - field - mapping. html > _ | def get_field_mapping(self, fields, index=None, doc_type=None, params=None):
"""
Retrieve mapping definition of a specific field.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html>`_
:arg fields: A comma-separated list of fields
:arg... |
Create an alias for a specific index/ indices. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - aliases. html > _ | def put_alias(self, index, name, body=None, params=None):
"""
Create an alias for a specific index/indices.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_
:arg index: A comma-separated list of index names the alias should point
to (s... |
Return a boolean indicating whether given alias exists. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - aliases. html > _ | def exists_alias(self, index=None, name=None, params=None):
"""
Return a boolean indicating whether given alias exists.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_
:arg index: A comma-separated list of index names to filter aliases
:a... |
Retrieve a specified alias. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - aliases. html > _ | def get_alias(self, index=None, name=None, params=None):
"""
Retrieve a specified alias.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_
:arg index: A comma-separated list of index names to filter aliases
:arg name: A comma-separated list... |
Update specified aliases. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - aliases. html > _ | def update_aliases(self, body, params=None):
"""
Update specified aliases.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_
:arg body: The definition of `actions` to perform
:arg master_timeout: Specify timeout for connection to master
... |
Delete specific alias. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - aliases. html > _ | def delete_alias(self, index, name, params=None):
"""
Delete specific alias.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html>`_
:arg index: A comma-separated list of index names (supports wildcards);
use `_all` for all indices
:a... |
Retrieve an index template by its name. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - templates. html > _ | def get_template(self, name=None, params=None):
"""
Retrieve an index template by its name.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html>`_
:arg name: The name of the template
:arg flat_settings: Return settings in flat format (default:... |
Retrieve settings for one or more ( or all ) indices. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - get - settings. html > _ | def get_settings(self, index=None, name=None, params=None):
"""
Retrieve settings for one or more (or all) indices.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html>`_
:arg index: A comma-separated list of index names; use `_all` or empty
... |
Retrieve statistics on different operations happening on an index. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - stats. html > _ | def stats(self, index=None, metric=None, params=None):
"""
Retrieve statistics on different operations happening on an index.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html>`_
:arg index: A comma-separated list of index names; use `_all` or empty
... |
Clear either all caches or specific cached associated with one ore more indices. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - clearcache. html > _ | def clear_cache(self, index=None, params=None):
"""
Clear either all caches or specific cached associated with one ore more indices.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html>`_
:arg index: A comma-separated list of index name to limit the ... |
Upgrade one or more indices to the latest format through an API. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - upgrade. html > _ | def upgrade(self, index=None, params=None):
"""
Upgrade one or more indices to the latest format through an API.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-upgrade.html>`_
:arg index: A comma-separated list of index names; use `_all` or empty
st... |
Monitor how much of one or more index is upgraded. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - upgrade. html > _ | def get_upgrade(self, index=None, params=None):
"""
Monitor how much of one or more index is upgraded.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-upgrade.html>`_
:arg index: A comma-separated list of index names; use `_all` or empty
string to pe... |
Perform a normal flush then add a generated unique marker ( sync_id ) to all shards. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ indices - synced - flush. html > _ | def flush_synced(self, index=None, params=None):
"""
Perform a normal flush, then add a generated unique marker (sync_id) to all shards.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html>`_
:arg index: A comma-separated list of index names; use `... |
Provides store information for shard copies of indices. Store information reports on which nodes shard copies exist the shard copy version indicating how recent they are and any exceptions encountered while opening the shard index or from earlier engine failure. <http:// www. elastic. co/ guide/ en/ elasticsearch/ refe... | def shard_stores(self, index=None, params=None):
"""
Provides store information for shard copies of indices. Store
information reports on which nodes shard copies exist, the shard copy
version, indicating how recent they are, and any exceptions encountered
while opening the shard... |
The force merge API allows to force merging of one or more indices through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by merging them. | def forcemerge(self, index=None, params=None):
"""
The force merge API allows to force merging of one or more indices
through an API. The merge relates to the number of segments a Lucene
index holds within each shard. The force merge operation allows to
reduce the number of segme... |
The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 primary shards can be shrunk into 4 2 or 1 primary shards or an index with 15 primary s... | def shrink(self, index, target, body=None, params=None):
"""
The shrink index API allows you to shrink an existing index into a new
index with fewer primary shards. The number of primary shards in the
target index must be a factor of the shards in the source index. For
example an... |
The rollover index API rolls an alias over to a new index when the existing index is considered to be too large or too old. | def rollover(self, alias, new_index=None, body=None, params=None):
"""
The rollover index API rolls an alias over to a new index when the
existing index is considered to be too large or too old.
The API accepts a single alias name and a list of conditions. The alias
must point t... |
Retrieve information about a snapshot. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ modules - snapshots. html > _ | def get(self, repository, snapshot, params=None):
"""
Retrieve information about a snapshot.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
:arg repository: A repository name
:arg snapshot: A comma-separated list of snapshot names
... |
Removes a shared file system repository. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ modules - snapshots. html > _ | def delete_repository(self, repository, params=None):
"""
Removes a shared file system repository.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
:arg repository: A comma-separated list of repository names
:arg master_timeout: Explicit... |
Return information about registered repositories. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ modules - snapshots. html > _ | def get_repository(self, repository=None, params=None):
"""
Return information about registered repositories.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
:arg repository: A comma-separated list of repository names
:arg local: Return... |
Registers a shared file system repository. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ modules - snapshots. html > _ | def create_repository(self, repository, body, params=None):
"""
Registers a shared file system repository.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
:arg repository: A repository name
:arg body: The repository definition
:... |
Restore a snapshot. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ modules - snapshots. html > _ | def restore(self, repository, snapshot, body=None, params=None):
"""
Restore a snapshot.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
:arg repository: A repository name
:arg snapshot: A snapshot name
:arg body: Details of wha... |
Return information about all currently running snapshots. By specifying a repository name it s possible to limit the results to a particular repository. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ modules - snapshots. html > _ | def status(self, repository=None, snapshot=None, params=None):
"""
Return information about all currently running snapshots. By specifying
a repository name, it's possible to limit the results to a particular
repository.
`<http://www.elastic.co/guide/en/elasticsearch/reference/cu... |
Escape a single value of a URL string or a query parameter. If it is a list or tuple turn it into a comma - separated string first. | def _escape(value):
"""
Escape a single value of a URL string or a query parameter. If it is a list
or tuple, turn it into a comma-separated string first.
"""
# make sequences into comma-separated stings
if isinstance(value, (list, tuple)):
value = ",".join(value)
# dates and datet... |
Create a URL string from parts omit all None values and empty strings. Convert lists and tuples to comma separated values. | def _make_path(*parts):
"""
Create a URL string from parts, omit all `None` values and empty strings.
Convert lists and tuples to comma separated values.
"""
# TODO: maybe only allow some parts to be lists/tuples ?
return "/" + "/".join(
# preserve ',' and '*' in url for nicer URLs in lo... |
Decorator that pops all accepted parameters from method s kwargs and puts them in the params argument. | def query_params(*es_query_params):
"""
Decorator that pops all accepted parameters from method's kwargs and puts
them in the params argument.
"""
def _wrapper(func):
@wraps(func)
def _wrapped(*args, **kwargs):
params = {}
if "params" in kwargs:
... |
Retrieve information for a particular task. <http:// www. elastic. co/ guide/ en/ elasticsearch/ reference/ current/ tasks. html > _ | def get(self, task_id=None, params=None):
"""
Retrieve information for a particular task.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html>`_
:arg task_id: Return the task with specified id (node_id:task_number)
:arg wait_for_completion: Wait for the m... |
Simple utility function to print results of a search query. | def print_hits(results):
" Simple utility function to print results of a search query. "
print_search_stats(results)
for hit in results['hits']['hits']:
# get created date for a repo and fallback to authored_date for a commit
created_at = parse_date(hit['_source'].get('created_at', hit['_sou... |
Deal with incoming requests. | def post(self):
"""Deal with incoming requests."""
body = tornado.escape.json_decode(self.request.body)
try:
self._bo.register(
params=body["params"],
target=body["target"],
)
print("BO has registered: {} points.".format(len(se... |
Expect observation with known target | def register(self, params, target):
"""Expect observation with known target"""
self._space.register(params, target)
self.dispatch(Events.OPTMIZATION_STEP) |
Probe target of x | def probe(self, params, lazy=True):
"""Probe target of x"""
if lazy:
self._queue.add(params)
else:
self._space.probe(params)
self.dispatch(Events.OPTMIZATION_STEP) |
Most promissing point to probe next | def suggest(self, utility_function):
"""Most promissing point to probe next"""
if len(self._space) == 0:
return self._space.array_to_params(self._space.random_sample())
# Sklearn's GP throws a large number of warnings at times, but
# we don't really need to see them here.
... |
Make sure there s something in the queue at the very beginning. | def _prime_queue(self, init_points):
"""Make sure there's something in the queue at the very beginning."""
if self._queue.empty and self._space.empty:
init_points = max(init_points, 1)
for _ in range(init_points):
self._queue.add(self._space.random_sample()) |
Mazimize your function | def maximize(self,
init_points=5,
n_iter=25,
acq='ucb',
kappa=2.576,
xi=0.0,
**gp_params):
"""Mazimize your function"""
self._prime_subscriptions()
self.dispatch(Events.OPTMIZATION_START)
... |
Append a point and its target value to the known data. | def register(self, params, target):
"""
Append a point and its target value to the known data.
Parameters
----------
x : ndarray
a single point, with len(x) == self.dim
y : float
target function value
Raises
------
KeyErr... |
Evaulates a single point x to obtain the value y and then records them as observations. | def probe(self, params):
"""
Evaulates a single point x, to obtain the value y and then records them
as observations.
Notes
-----
If x has been previously seen returns a cached value of y.
Parameters
----------
x : ndarray
a single po... |
Creates random points within the bounds of the space. | def random_sample(self):
"""
Creates random points within the bounds of the space.
Returns
----------
data: ndarray
[num x dim] array points with dimensions corresponding to `self._keys`
Example
-------
>>> target_func = lambda p1, p2: p1 + p... |
Get maximum target value found and corresponding parametes. | def max(self):
"""Get maximum target value found and corresponding parametes."""
try:
res = {
'target': self.target.max(),
'params': dict(
zip(self.keys, self.params[self.target.argmax()])
)
}
except Valu... |
Get all target values found and corresponding parametes. | def res(self):
"""Get all target values found and corresponding parametes."""
params = [dict(zip(self.keys, p)) for p in self.params]
return [
{"target": target, "params": param}
for target, param in zip(self.target, params)
] |
A method that allows changing the lower and upper searching bounds | def set_bounds(self, new_bounds):
"""
A method that allows changing the lower and upper searching bounds
Parameters
----------
new_bounds : dict
A dictionary with the parameter name and its new bounds
"""
for row, key in enumerate(self.keys):
... |
Synthetic binary classification dataset. | def get_data():
"""Synthetic binary classification dataset."""
data, targets = make_classification(
n_samples=1000,
n_features=45,
n_informative=12,
n_redundant=7,
random_state=134985745,
)
return data, targets |
SVC cross validation. | def svc_cv(C, gamma, data, targets):
"""SVC cross validation.
This function will instantiate a SVC classifier with parameters C and
gamma. Combined with data and targets this will in turn be used to perform
cross validation. The result of cross validation is returned.
Our goal is to find combinati... |
Random Forest cross validation. | def rfc_cv(n_estimators, min_samples_split, max_features, data, targets):
"""Random Forest cross validation.
This function will instantiate a random forest classifier with parameters
n_estimators, min_samples_split, and max_features. Combined with data and
targets this will in turn be used to perform c... |
Apply Bayesian Optimization to SVC parameters. | def optimize_svc(data, targets):
"""Apply Bayesian Optimization to SVC parameters."""
def svc_crossval(expC, expGamma):
"""Wrapper of SVC cross validation.
Notice how we transform between regular and log scale. While this
is not technically necessary, it greatly improves the performance... |
Apply Bayesian Optimization to Random Forest parameters. | def optimize_rfc(data, targets):
"""Apply Bayesian Optimization to Random Forest parameters."""
def rfc_crossval(n_estimators, min_samples_split, max_features):
"""Wrapper of RandomForest cross validation.
Notice how we ensure n_estimators and min_samples_split are casted
to integer bef... |
A function to find the maximum of the acquisition function | def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=100000, n_iter=250):
"""
A function to find the maximum of the acquisition function
It uses a combination of random sampling (cheap) and the 'L-BFGS-B'
optimization method. First by sampling `n_warmup` (1e5) points at random,
and then runnin... |
Load previous... | def load_logs(optimizer, logs):
"""Load previous ...
"""
import json
if isinstance(logs, str):
logs = [logs]
for log in logs:
with open(log, "r") as j:
while True:
try:
iteration = next(j)
except StopIteration:
... |
Creates a random number generator based on an optional seed. This can be an integer or another random state for a seeded rng or None for an unseeded rng. | def ensure_rng(random_state=None):
"""
Creates a random number generator based on an optional seed. This can be
an integer or another random state for a seeded rng, or None for an
unseeded rng.
"""
if random_state is None:
random_state = np.random.RandomState()
elif isinstance(rando... |
Expand abbreviations in a template name. | def expand_abbreviations(template, abbreviations):
"""Expand abbreviations in a template name.
:param template: The project template name.
:param abbreviations: Abbreviation definitions.
"""
if template in abbreviations:
return abbreviations[template]
# Split on colon. If there is no c... |
Determine if repo_directory contains a cookiecutter. json file. | def repository_has_cookiecutter_json(repo_directory):
"""Determine if `repo_directory` contains a `cookiecutter.json` file.
:param repo_directory: The candidate repository directory.
:return: True if the `repo_directory` is valid, else False.
"""
repo_directory_exists = os.path.isdir(repo_directory... |
Locate the repository directory from a template reference. | def determine_repo_dir(template, abbreviations, clone_to_dir, checkout,
no_input, password=None):
"""
Locate the repository directory from a template reference.
Applies repository abbreviations to the template reference.
If the template refers to a repository URL, clone it.
I... |
Determine which child directory of repo_dir is the project template. | def find_template(repo_dir):
"""Determine which child directory of `repo_dir` is the project template.
:param repo_dir: Local directory of newly cloned repo.
:returns project_template: Relative path to project template.
"""
logger.debug('Searching {} for the project template.'.format(repo_dir))
... |
Check whether the given path should only be copied and not rendered. | def is_copy_only_path(path, context):
"""Check whether the given `path` should only be copied and not rendered.
Returns True if `path` matches a pattern in the given `context` dict,
otherwise False.
:param path: A file-system path referring to a file or dir that
should be rendered or just copi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.