class Sensit::Api::Report
Reports are stored filter and facet queries on the Feed data. A report is a assigned a ‘name` and the `query` is any elasticsearch query which filters only the desired data for the facets (See the [elasticsearch Query DSL](www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-queries.html) for valid queries). A report can have many `facets` with each facet is referred to by a user defined `name`. Valid `type`’s of facet include terms, range, histogram, filter, statistical, query, terms_stats, or geo_distance. The ‘query` within a facet defines the field counts or statistics which the data is calculated over. See the [elasticsearch facet dsl](www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets.html) for information about the various facet types and valid query fields.
topic_id - The key for the parent topic id - The identifier of the report
Public Class Methods
# File lib/sensit/api/report.rb, line 11 def initialize(topic_id, id, client) @topic_id = topic_id @id = id @client = client end
Public Instance Methods
Create a new report on the associated Topic
which can be easily retrieved later using an id. Requires authorization of manage_any_reports, or manage_application_reports. ‘/topics/:topic_id/reports’ POST
report - A Hash containing ‘name`: The name of the report (required).`query`:The search query acccording to the [elasticsearch Query DSL](www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-queries.html) to filter the data for the facets (Defaults to match all).`facets`:An array of facet hashes which each contain a `name` ad type of the facet along with its query hash (required).
# File lib/sensit/api/report.rb, line 43 def create(report, options = {}) body = options.has_key?(:body) ? options[:body] : {} body[:report] = report response = @client.post "/topics/#{@topic_id}/reports", body, options return response end
Remove a saved report on the associated Topic
by Id. Requires authorization of manage_any_reports, or manage_application_reports. ‘/topics/:topic_id/reports/:id’ DELETE
# File lib/sensit/api/report.rb, line 68 def delete(options = {}) body = options.has_key?(:body) ? options[:body] : {} response = @client.delete "/topics/#{@topic_id}/reports/#{@id}", body, options return response end
Retrieve a specific report on the associated topic by Id. Requires authorization of read_any_reports, or read_application_reports. ‘/topics/:topic_id/reports/:id’ GET
# File lib/sensit/api/report.rb, line 31 def find(options = {}) body = options.has_key?(:query) ? options[:query] : {} response = @client.get "/topics/#{@topic_id}/reports/#{@id}", body, options return response end
Get all reports for the associated Topic
. Requires authorization of read_any_reports, or read_application_reports. ‘/topics/:topic_id/reports’ GET
# File lib/sensit/api/report.rb, line 20 def list(options = {}) body = options.has_key?(:query) ? options[:query] : {} response = @client.get "/topics/#{@topic_id}/reports", body, options return response end
Update the query, facets or name of the report. Requires authorization of manage_any_reports, or manage_application_reports. ‘/topics/:topic_id/reports/:id’ PUT
report - A Hash containing ‘name`: The name of the report (required).`query`:The search query acccording to the [elasticsearch Query DSL](www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-queries.html) to filter the data for the facets (Defaults to match all).`facets`:An array of facet hashes which each contain a `name` ad type of the facet along with its query hash (required).
# File lib/sensit/api/report.rb, line 56 def update(report, options = {}) body = options.has_key?(:body) ? options[:body] : {} body[:report] = report response = @client.put "/topics/#{@topic_id}/reports/#{@id}", body, options return response end