1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

[bug] event catgories not correct in statistics

This commit is contained in:
Sylvain 2018-07-12 12:48:50 +02:00
parent 05bd65dfb2
commit 407c18075c
4 changed files with 114 additions and 92 deletions

View File

@ -5,10 +5,12 @@
- Upgraded ElasticSearch from 1.7 to 5.6 - Upgraded ElasticSearch from 1.7 to 5.6
- Updated OmniAuth to fix Hashie warnings [omniauth#872](https://github.com/omniauth/omniauth/issues/872) - Updated OmniAuth to fix Hashie warnings [omniauth#872](https://github.com/omniauth/omniauth/issues/872)
- Fix a bug: unable to filter statistics from age 0 - Fix a bug: unable to filter statistics from age 0
- Fix a bug: events categories are not reported correctly in statistics
- Fix a security issue: dependency loofah has a vulnerability as described in [CVE-2018-8048](https://github.com/flavorjones/loofah/issues/144) - Fix a security issue: dependency loofah has a vulnerability as described in [CVE-2018-8048](https://github.com/flavorjones/loofah/issues/144)
- Fix a security issue: rails-html-sanitizer < 1.0.3 has a security vulnerability described in [CVE-2018-3741](https://nvd.nist.gov/vuln/detail/CVE-2018-3741) - Fix a security issue: rails-html-sanitizer < 1.0.3 has a security vulnerability described in [CVE-2018-3741](https://nvd.nist.gov/vuln/detail/CVE-2018-3741)
- Ensure elasticSearch indices are started with green status on new installations - Ensure elasticSearch indices are started with green status on new installations
- [TODO DEPLOY] **REQUIRED** Please read [elastic_upgrade.md](doc/elastic_upgrade.md) for instructions on upgrading ElasticSearch. - [TODO DEPLOY] **IMPORTANT** Please read [elastic_upgrade.md](doc/elastic_upgrade.md) for instructions on upgrading ElasticSearch.
- [TODO DEPLOY] `rake fablab:fix:categories_slugs`
## v2.6.4 2018 March 15 ## v2.6.4 2018 March 15

View File

@ -242,7 +242,7 @@ class StatisticService
date: options[:start_date].to_date, date: options[:start_date].to_date,
reservation_id: r.id, reservation_id: r.id,
event_id: r.reservable.id, event_id: r.reservable.id,
event_type: r.reservable.category.name, event_type: r.reservable.category.slug,
event_name: r.reservable.name, event_name: r.reservable.name,
event_date: slot.start_at.to_date, event_date: slot.start_at.to_date,
event_theme: (r.reservable.event_themes.first ? r.reservable.event_themes.first.name : ''), event_theme: (r.reservable.event_themes.first ? r.reservable.event_themes.first.name : ''),

View File

@ -32,14 +32,14 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree
create_table "addresses", force: :cascade do |t| create_table "addresses", force: :cascade do |t|
t.string "address" t.string "address", limit: 255
t.string "street_number" t.string "street_number", limit: 255
t.string "route" t.string "route", limit: 255
t.string "locality" t.string "locality", limit: 255
t.string "country" t.string "country", limit: 255
t.string "postal_code" t.string "postal_code", limit: 255
t.integer "placeable_id" t.integer "placeable_id"
t.string "placeable_type" t.string "placeable_type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -55,9 +55,9 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "assets", force: :cascade do |t| create_table "assets", force: :cascade do |t|
t.integer "viewable_id" t.integer "viewable_id"
t.string "viewable_type" t.string "viewable_type", limit: 255
t.string "attachment" t.string "attachment", limit: 255
t.string "type" t.string "type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -74,12 +74,12 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "availabilities", force: :cascade do |t| create_table "availabilities", force: :cascade do |t|
t.datetime "start_at" t.datetime "start_at"
t.datetime "end_at" t.datetime "end_at"
t.string "available_type" t.string "available_type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "nb_total_places" t.integer "nb_total_places"
t.boolean "destroying", default: false t.boolean "destroying", default: false
t.boolean "lock", default: false t.boolean "lock", default: false
end end
create_table "availability_tags", force: :cascade do |t| create_table "availability_tags", force: :cascade do |t|
@ -93,7 +93,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
create_table "categories", force: :cascade do |t| create_table "categories", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "slug" t.string "slug"
@ -102,7 +102,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
create_table "components", force: :cascade do |t| create_table "components", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
end end
create_table "coupons", force: :cascade do |t| create_table "coupons", force: :cascade do |t|
@ -120,7 +120,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "credits", force: :cascade do |t| create_table "credits", force: :cascade do |t|
t.integer "creditable_id" t.integer "creditable_id"
t.string "creditable_type" t.string "creditable_type", limit: 255
t.integer "plan_id" t.integer "plan_id"
t.integer "hours" t.integer "hours"
t.datetime "created_at" t.datetime "created_at"
@ -161,7 +161,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
create_table "events", force: :cascade do |t| create_table "events", force: :cascade do |t|
t.string "title" t.string "title", limit: 255
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -199,10 +199,10 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
create_table "friendly_id_slugs", force: :cascade do |t| create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false t.string "slug", limit: 255, null: false
t.integer "sluggable_id", null: false t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50 t.string "sluggable_type", limit: 50
t.string "scope" t.string "scope", limit: 255
t.datetime "created_at" t.datetime "created_at"
end end
@ -212,10 +212,10 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
create_table "groups", force: :cascade do |t| create_table "groups", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "slug" t.string "slug", limit: 255
t.boolean "disabled" t.boolean "disabled"
end end
@ -223,7 +223,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "invoice_items", force: :cascade do |t| create_table "invoice_items", force: :cascade do |t|
t.integer "invoice_id" t.integer "invoice_id"
t.string "stp_invoice_item_id" t.string "stp_invoice_item_id", limit: 255
t.integer "amount" t.integer "amount"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -236,17 +236,17 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "invoices", force: :cascade do |t| create_table "invoices", force: :cascade do |t|
t.integer "invoiced_id" t.integer "invoiced_id"
t.string "invoiced_type" t.string "invoiced_type", limit: 255
t.string "stp_invoice_id" t.string "stp_invoice_id", limit: 255
t.integer "total" t.integer "total"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "user_id" t.integer "user_id"
t.string "reference" t.string "reference", limit: 255
t.string "avoir_mode" t.string "avoir_mode", limit: 255
t.datetime "avoir_date" t.datetime "avoir_date"
t.integer "invoice_id" t.integer "invoice_id"
t.string "type" t.string "type", limit: 255
t.boolean "subscription_to_expire" t.boolean "subscription_to_expire"
t.text "description" t.text "description"
t.integer "wallet_amount" t.integer "wallet_amount"
@ -260,17 +260,17 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
create_table "licences", force: :cascade do |t| create_table "licences", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
t.text "description" t.text "description"
end end
create_table "machines", force: :cascade do |t| create_table "machines", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
t.text "description" t.text "description"
t.text "spec" t.text "spec"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "slug" t.string "slug", limit: 255
t.boolean "disabled" t.boolean "disabled"
end end
@ -287,14 +287,14 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "notifications", force: :cascade do |t| create_table "notifications", force: :cascade do |t|
t.integer "receiver_id" t.integer "receiver_id"
t.integer "attached_object_id" t.integer "attached_object_id"
t.string "attached_object_type" t.string "attached_object_type", limit: 255
t.integer "notification_type_id" t.integer "notification_type_id"
t.boolean "is_read", default: false t.boolean "is_read", default: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "receiver_type" t.string "receiver_type"
t.boolean "is_send", default: false t.boolean "is_send", default: false
t.jsonb "meta_data", default: {} t.jsonb "meta_data", default: {}
end end
add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree
@ -363,20 +363,20 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
create_table "plans", force: :cascade do |t| create_table "plans", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.integer "amount" t.integer "amount"
t.string "interval" t.string "interval", limit: 255
t.integer "group_id" t.integer "group_id"
t.string "stp_plan_id" t.string "stp_plan_id", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "training_credit_nb", default: 0 t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true t.boolean "is_rolling", default: true
t.text "description" t.text "description"
t.string "type" t.string "type"
t.string "base_name" t.string "base_name"
t.integer "ui_weight", default: 0 t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1 t.integer "interval_count", default: 1
t.string "slug" t.string "slug"
t.boolean "disabled" t.boolean "disabled"
end end
@ -406,11 +406,11 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "profiles", force: :cascade do |t| create_table "profiles", force: :cascade do |t|
t.integer "user_id" t.integer "user_id"
t.string "first_name" t.string "first_name", limit: 255
t.string "last_name" t.string "last_name", limit: 255
t.boolean "gender" t.boolean "gender"
t.date "birthday" t.date "birthday"
t.string "phone" t.string "phone", limit: 255
t.text "interest" t.text "interest"
t.text "software_mastered" t.text "software_mastered"
t.datetime "created_at" t.datetime "created_at"
@ -440,7 +440,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
t.integer "project_id" t.integer "project_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "title" t.string "title", limit: 255
t.integer "step_nb" t.integer "step_nb"
end end
@ -451,27 +451,27 @@ ActiveRecord::Schema.define(version: 20171011125217) do
t.integer "user_id" t.integer "user_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "is_valid", default: false t.boolean "is_valid", default: false
t.string "valid_token" t.string "valid_token", limit: 255
end end
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
create_table "projects", force: :cascade do |t| create_table "projects", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "author_id" t.integer "author_id"
t.text "tags" t.text "tags"
t.integer "licence_id" t.integer "licence_id"
t.string "state" t.string "state", limit: 255
t.string "slug" t.string "slug", limit: 255
t.datetime "published_at" t.datetime "published_at"
end end
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
create_table "projects_components", force: :cascade do |t| create_table "projects_components", force: :cascade do |t|
t.integer "project_id" t.integer "project_id"
@ -511,20 +511,19 @@ ActiveRecord::Schema.define(version: 20171011125217) do
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "reservable_id" t.integer "reservable_id"
t.string "reservable_type" t.string "reservable_type", limit: 255
t.string "stp_invoice_id" t.string "stp_invoice_id", limit: 255
t.integer "nb_reserve_places" t.integer "nb_reserve_places"
end end
add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
create_table "roles", force: :cascade do |t| create_table "roles", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.integer "resource_id" t.integer "resource_id"
t.string "resource_type" t.string "resource_type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -599,18 +598,18 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "statistic_fields", force: :cascade do |t| create_table "statistic_fields", force: :cascade do |t|
t.integer "statistic_index_id" t.integer "statistic_index_id"
t.string "key" t.string "key", limit: 255
t.string "label" t.string "label", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "data_type" t.string "data_type", limit: 255
end end
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
create_table "statistic_graphs", force: :cascade do |t| create_table "statistic_graphs", force: :cascade do |t|
t.integer "statistic_index_id" t.integer "statistic_index_id"
t.string "chart_type" t.string "chart_type", limit: 255
t.integer "limit" t.integer "limit"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -619,17 +618,17 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
create_table "statistic_indices", force: :cascade do |t| create_table "statistic_indices", force: :cascade do |t|
t.string "es_type_key" t.string "es_type_key", limit: 255
t.string "label" t.string "label", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "table", default: true t.boolean "table", default: true
t.boolean "ca", default: true t.boolean "ca", default: true
end end
create_table "statistic_sub_types", force: :cascade do |t| create_table "statistic_sub_types", force: :cascade do |t|
t.string "key" t.string "key", limit: 255
t.string "label" t.string "label", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -646,8 +645,8 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "statistic_types", force: :cascade do |t| create_table "statistic_types", force: :cascade do |t|
t.integer "statistic_index_id" t.integer "statistic_index_id"
t.string "key" t.string "key", limit: 255
t.string "label" t.string "label", limit: 255
t.boolean "graph" t.boolean "graph"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -665,7 +664,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
create_table "subscriptions", force: :cascade do |t| create_table "subscriptions", force: :cascade do |t|
t.integer "plan_id" t.integer "plan_id"
t.integer "user_id" t.integer "user_id"
t.string "stp_subscription_id" t.string "stp_subscription_id", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.datetime "expired_at" t.datetime "expired_at"
@ -684,7 +683,7 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
create_table "themes", force: :cascade do |t| create_table "themes", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
end end
create_table "tickets", force: :cascade do |t| create_table "tickets", force: :cascade do |t|
@ -699,13 +698,13 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
create_table "trainings", force: :cascade do |t| create_table "trainings", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "nb_total_places" t.integer "nb_total_places"
t.string "slug" t.string "slug", limit: 255
t.text "description" t.text "description"
t.boolean "public_page", default: true t.boolean "public_page", default: true
t.boolean "disabled" t.boolean "disabled"
end end
@ -761,32 +760,32 @@ ActiveRecord::Schema.define(version: 20171011125217) do
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", default: "", null: false t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token" t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip" t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token" t.string "confirmation_token", limit: 255
t.datetime "confirmed_at" t.datetime "confirmed_at"
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at"
t.string "unconfirmed_email" t.string "unconfirmed_email", limit: 255
t.integer "failed_attempts", default: 0, null: false t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token" t.string "unlock_token", limit: 255
t.datetime "locked_at" t.datetime "locked_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "is_allow_contact", default: true t.boolean "is_allow_contact", default: true
t.integer "group_id" t.integer "group_id"
t.string "stp_customer_id" t.string "stp_customer_id", limit: 255
t.string "username" t.string "username", limit: 255
t.string "slug" t.string "slug", limit: 255
t.boolean "is_active", default: true t.boolean "is_active", default: true
t.boolean "invoicing_disabled", default: false t.boolean "invoicing_disabled", default: false
t.string "provider" t.string "provider"
t.string "uid" t.string "uid"
t.string "auth_token" t.string "auth_token"

View File

@ -85,5 +85,26 @@ namespace :fablab do
puts "#{Event.where(recurrence_id: failed_ids).map(&:id)}" puts "#{Event.where(recurrence_id: failed_ids).map(&:id)}"
end end
end end
desc 'reset slug in events categories'
task categories_slugs: :environment do
Category.all.each do |cat|
`curl -XPOST http://#{ENV["ELASTICSEARCH_HOST"]}:9200/stats/event/_update_by_query?conflicts=proceed&refresh&wait_for_completion -d '
{
"script": {
"source": "ctx._source.subType = params.slug",
"lang": "painless",
"params": {
"slug": "#{cat.slug}"
}
},
"query": {
"term": {
"subType": "#{cat.name}"
}
}
}';`
end
end
end end
end end