Ejemplo n.º 1
0
    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
        """
        return self.transport.perform_request('GET', _make_path('_xpack', 'ml',
            'anomaly_detectors', job_id), params=params)
Ejemplo n.º 2
0
    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
        """
        return self.transport.perform_request('GET', _make_path('_xpack', 'ml',
            'datafeeds', datafeed_id, '_stats'), params=params)
Ejemplo n.º 3
0
    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('DELETE', _make_path('_xpack',
            'ml', 'filters', filter_id), params=params)
Ejemplo n.º 4
0
    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', _make_path('_xpack', 'ml',
            'filters', filter_id), params=params)
Ejemplo n.º 5
0
    def open_job(self, job_id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html>`_

        :arg job_id: The ID of the job to open
        """
        if job_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'job_id'.")
        return self.transport.perform_request('POST', _make_path('_xpack', 'ml',
            'anomaly_detectors', job_id, '_open'), params=params)
Ejemplo n.º 6
0
    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("Empty value passed for a required argument 'datafeed_id'.")
        return self.transport.perform_request('GET', _make_path('_xpack', 'ml',
            'datafeeds', datafeed_id, '_preview'), params=params)
Ejemplo n.º 7
0
    def put_filter(self, filter_id, body, params=None):
        """

        :arg filter_id: The ID of the filter to create
        :arg body: The filter details
        """
        for param in (filter_id, body):
            if param in SKIP_IN_PATH:
                raise ValueError("Empty value passed for a required argument.")
        return self.transport.perform_request('PUT', _make_path('_xpack', 'ml',
            'filters', filter_id), params=params, body=body)
Ejemplo n.º 8
0
    def info(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, '_xpack', 'migration',
                                                  'deprecations'),
                                              params=params)
Ejemplo n.º 9
0
    def get_watch(self, id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html>`_

        :arg id: Watch ID
        """
        if id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'id'.")
        return self.transport.perform_request('GET', _make_path('_xpack',
            'watcher', 'watch', id), params=params)
Ejemplo n.º 10
0
    def stats(self, metric=None, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html>`_

        :arg metric: Controls what additional stat metrics should be include in
            the response
        :arg emit_stacktraces: Emits stack traces of currently running watches
        """
        return self.transport.perform_request('GET', _make_path('_xpack',
            'watcher', 'stats', metric), params=params)
Ejemplo n.º 11
0
    def get_role_mapping(self, name=None, params=None):
        """
        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html#security-api-get-role-mapping>`_

        :arg name: Role-Mapping name
        """
        return self.transport.perform_request('GET',
                                              _make_path(
                                                  '_xpack', 'security',
                                                  'role_mapping', name),
                                              params=params)
Ejemplo n.º 12
0
    def execute_watch(self, id=None, body=None, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html>`_

        :arg id: Watch ID
        :arg body: Execution control
        :arg debug: indicates whether the watch should execute in debug mode
        """
        return self.transport.perform_request('PUT', _make_path('_xpack',
            'watcher', 'watch', id, '_execute'), params=params, body=body)
Ejemplo n.º 13
0
    def delete_datafeed(self, datafeed_id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html>`_

        :arg datafeed_id: The ID of the datafeed to delete
        :arg force: True if the datafeed should be forcefully deleted
        """
        if datafeed_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'datafeed_id'.")
        return self.transport.perform_request('DELETE', _make_path('_xpack',
            'ml', 'datafeeds', datafeed_id), params=params)
Ejemplo n.º 14
0
    def get_user(self, username=None, params=None):
        """

        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-get-user>`_

        :arg username: A comma-separated list of usernames
        """
        return self.transport.perform_request('GET',
                                              _make_path(
                                                  '_xpack', 'security', 'user',
                                                  username),
                                              params=params)
Ejemplo n.º 15
0
    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
        """
        if job_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'job_id'.")
        return self.transport.perform_request('DELETE', _make_path('_xpack',
            'ml', 'anomaly_detectors', job_id), params=params)
Ejemplo n.º 16
0
    def delete_watch(self, id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html>`_

        :arg id: Watch ID
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        """
        if id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'id'.")
        return self.transport.perform_request('DELETE', _make_path('_xpack',
            'watcher', 'watch', id), params=params)
Ejemplo n.º 17
0
    def update_job(self, job_id, body, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html>`_

        :arg job_id: The ID of the job to create
        :arg body: The job update settings
        """
        for param in (job_id, body):
            if param in SKIP_IN_PATH:
                raise ValueError("Empty value passed for a required argument.")
        return self.transport.perform_request('POST', _make_path('_xpack', 'ml',
            'anomaly_detectors', job_id, '_update'), params=params, body=body)
Ejemplo n.º 18
0
    def put_datafeed(self, datafeed_id, body, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html>`_

        :arg datafeed_id: The ID of the datafeed to create
        :arg body: The datafeed config
        """
        for param in (datafeed_id, body):
            if param in SKIP_IN_PATH:
                raise ValueError("Empty value passed for a required argument.")
        return self.transport.perform_request('PUT', _make_path('_xpack', 'ml',
            'datafeeds', datafeed_id), params=params, body=body)
Ejemplo n.º 19
0
    def forecast_job(self, job_id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html>`_

        :arg job_id: The name of the job to close
        :arg duration: A period of time that indicates how far into the future to forecast
        :arg expires_in: The period of time that forecast results are retained.
        """
        if job_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'job_id'.")
        return self.transport.perform_request('POST', _make_path('_xpack', 'ml',
            'anomaly_detectors', job_id, '_forecast'), params=params)
Ejemplo n.º 20
0
    def ack_watch(self, watch_id, action_id=None, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html>`_

        :arg watch_id: Watch ID
        :arg action_id: A comma-separated list of the action ids to be acked
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        """
        if watch_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'watch_id'.")
        return self.transport.perform_request('PUT', _make_path('_xpack',
            'watcher', 'watch', watch_id, '_ack', action_id), params=params)
Ejemplo n.º 21
0
    def close_job(self, job_id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html>`_

        :arg job_id: The name of the job to close
        :arg force: True if the job should be forcefully closed
        :arg timeout: Controls the time to wait until a job has closed. Default
            to 30 minutes
        """
        if job_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'job_id'.")
        return self.transport.perform_request('POST', _make_path('_xpack', 'ml',
            'anomaly_detectors', job_id, '_close'), params=params)
Ejemplo n.º 22
0
    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 (job_id, snapshot_id):
            if param in SKIP_IN_PATH:
                raise ValueError("Empty value passed for a required argument.")
        return self.transport.perform_request('DELETE', _make_path('_xpack',
            'ml', 'anomaly_detectors', job_id, 'model_snapshots', snapshot_id),
            params=params)
Ejemplo n.º 23
0
    def stop_datafeed(self, datafeed_id, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html>`_

        :arg datafeed_id: The ID of the datafeed to stop
        :arg force: True if the datafeed should be forcefully stopped.
        :arg timeout: Controls the time to wait until a datafeed has stopped.
            Default to 20 seconds
        """
        if datafeed_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'datafeed_id'.")
        return self.transport.perform_request('POST', _make_path('_xpack', 'ml',
            'datafeeds', datafeed_id, '_stop'), params=params)
Ejemplo n.º 24
0
    def clear_cached_roles(self, name, params=None):
        """

        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-roles.html#security-api-clear-role-cache>`_

        :arg name: Role name
        """
        if name in SKIP_IN_PATH:
            raise ValueError(
                "Empty value passed for a required argument 'name'.")
        return self.transport.perform_request('POST',
                                              _make_path(
                                                  '_xpack', 'security', 'role',
                                                  name, '_clear_cache'),
                                              params=params)
Ejemplo n.º 25
0
    def clear_cached_realms(self, realms, params=None):
        """

        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html>`_

        :arg realms: Comma-separated list of realms to clear
        :arg usernames: Comma-separated list of usernames to clear from the
            cache
        """
        if realms in SKIP_IN_PATH:
            raise ValueError(
                "Empty value passed for a required argument 'realms'.")
        return self.transport.perform_request(
            'POST',
            _make_path('_xpack', 'security', 'realm', realms, '_clear_cache'),
            params=params)
Ejemplo n.º 26
0
    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 body: Category selection details if not provided in URI
        :arg from_: skips a number of categories
        :arg size: specifies a max number of categories to get
        """
        if job_id in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'job_id'.")
        return self.transport.perform_request('GET', _make_path('_xpack', 'ml',
            'anomaly_detectors', job_id, 'results', 'categories', category_id),
            params=params, body=body)
Ejemplo n.º 27
0
    def enable_user(self, username=None, params=None):
        """
        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-enable-user>`_

        :arg username: The username of the user to enable
        :arg refresh: If `true` (the default) then refresh the affected shards
            to make this operation visible to search, if `wait_for` then wait
            for a refresh to make this operation visible to search, if `false`
            then do nothing with refreshes., valid choices are: 'true', 'false',
            'wait_for'
        """
        return self.transport.perform_request('PUT',
                                              _make_path(
                                                  '_xpack', 'security', 'user',
                                                  username, '_enable'),
                                              params=params)
Ejemplo n.º 28
0
    def put_watch(self, id, body, params=None):
        """

        `<http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html>`_

        :arg id: Watch ID
        :arg body: The watch
        :arg active: Specify whether the watch is in/active by default
        :arg master_timeout: Explicit operation timeout for connection to master
            node
        """
        for param in (id, body):
            if param in SKIP_IN_PATH:
                raise ValueError("Empty value passed for a required argument.")
        return self.transport.perform_request('PUT', _make_path('_xpack',
            'watcher', 'watch', id), params=params, body=body)
Ejemplo n.º 29
0
    def bulk(self, body, doc_type=None, params=None):
        """
        `<http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html>`_

        :arg body: The operation definition and data (action-data pairs),
            separated by newlines
        :arg doc_type: Default document type for items which don't provide one
        :arg interval: Collection interval (e.g., '10s' or '10000ms') of the
            payload
        :arg system_api_version: API Version of the monitored system
        :arg system_id: Identifier of the monitored system
        """
        if body in SKIP_IN_PATH:
            raise ValueError("Empty value passed for a required argument 'body'.")
        return self.transport.perform_request('POST', _make_path('_xpack',
            'monitoring', doc_type, '_bulk'), params=params,
            body=self.client._bulk_body(body))
Ejemplo n.º 30
0
    def upgrade(self, index, params=None):
        """

        `<https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html>`_

        :arg index: The name of the index
        :arg wait_for_completion: Should the request block until the upgrade
            operation is completed, default True
        """
        if index in SKIP_IN_PATH:
            raise ValueError(
                "Empty value passed for a required argument 'index'.")
        return self.transport.perform_request('POST',
                                              _make_path(
                                                  '_xpack', 'migration',
                                                  'upgrade', index),
                                              params=params)