diff --git a/lib/tasks/elasticsearch.rake b/lib/tasks/elasticsearch.rake index 89c0e7eb..12a61459 100644 --- a/lib/tasks/elasticsearch.rake +++ b/lib/tasks/elasticsearch.rake @@ -23,7 +23,7 @@ namespace :elasticsearch do type: 'keyword' } }, - analyzer: 'default' + analyzer: 'ts_analyzer' }, description: { type: 'text', @@ -32,7 +32,7 @@ namespace :elasticsearch do type: 'keyword' } }, - analyzer: 'default' + analyzer: 'ts_analyzer' }, contents: { type: 'text', @@ -41,7 +41,7 @@ namespace :elasticsearch do type: 'keyword' } }, - analyzer: 'default' + analyzer: 'ts_analyzer' }, grade_begin: { type: 'long' }, grade_end: { type: 'long' }, @@ -73,8 +73,7 @@ namespace :elasticsearch do } }, primary_language: { - type: 'text', - fielddata: true + type: 'keyword' }, available_copies: { type: 'long' }, bnumber: { @@ -84,12 +83,10 @@ namespace :elasticsearch do } }, set_type: { - type: 'text', - fielddata: true + type: 'keyword' }, area_of_study: { - type: 'text', - fielddata: true + type: 'keyword' }, created_at: { type: 'date', diff --git a/lib/tasks/seed_teacher_sets.rake b/lib/tasks/seed_teacher_sets.rake index 0cf28b8e..f0b586a4 100644 --- a/lib/tasks/seed_teacher_sets.rake +++ b/lib/tasks/seed_teacher_sets.rake @@ -3,8 +3,7 @@ namespace :seeds do task teacher_sets: :environment do failed = [] - - TeacherSet.find_each do |ts| + TeacherSet.find_each(batch_size: 1) do |ts| created_at = ts.created_at.present? ? ts.created_at.strftime("%Y-%m-%dT%H:%M:%S%z") : nil updated_at = ts.updated_at.present? ? ts.updated_at.strftime("%Y-%m-%dT%H:%M:%S%z") : nil availability = ts.availability.present? ? ts.availability.downcase : nil diff --git a/script/elastic_search/create_es_index_mappings.sh b/script/elastic_search/create_es_index_mappings.sh index 4e0d10fa..584c6b60 100755 --- a/script/elastic_search/create_es_index_mappings.sh +++ b/script/elastic_search/create_es_index_mappings.sh @@ -23,7 +23,7 @@ curl -XPUT "$es_url/teacherset?" -H 'Content-Type: application/json' -d ' "type": "keyword" } }, - "analyzer": "default" + "analyzer": "ts_analyzer" }, "description": { "type": "text", @@ -32,7 +32,7 @@ curl -XPUT "$es_url/teacherset?" -H 'Content-Type: application/json' -d ' "type": "keyword" } }, - "analyzer": "default" + "analyzer": "ts_analyzer" }, "contents": { "type": "text", @@ -41,7 +41,7 @@ curl -XPUT "$es_url/teacherset?" -H 'Content-Type: application/json' -d ' "type": "keyword" } }, - "analyzer": "default" + "analyzer": "ts_analyzer" }, "grade_begin": { "type": "long" @@ -91,8 +91,7 @@ curl -XPUT "$es_url/teacherset?" -H 'Content-Type: application/json' -d ' } }, "primary_language": { - "type": "text", - "fielddata": true + "type": "keyword" }, "available_copies": { "type": "long" @@ -106,12 +105,10 @@ curl -XPUT "$es_url/teacherset?" -H 'Content-Type: application/json' -d ' } }, "set_type": { - "type": "text", - "fielddata": true + "type": "keyword" }, "area_of_study": { - "type": "text", - "fielddata": true + "type": "keyword" }, "created_at": { "type": "date",