Skip to content

Commit

Permalink
Merge pull request #1466 from NYPL/elasticsearch-6.8_to_7.10
Browse files Browse the repository at this point in the history
Updated mappings
  • Loading branch information
gonuguntla authored Nov 25, 2024
2 parents 17fecc7 + e476b6e commit 743d4f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
15 changes: 6 additions & 9 deletions lib/tasks/elasticsearch.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace :elasticsearch do
type: 'keyword'
}
},
analyzer: 'default'
analyzer: 'ts_analyzer'
},
description: {
type: 'text',
Expand All @@ -32,7 +32,7 @@ namespace :elasticsearch do
type: 'keyword'
}
},
analyzer: 'default'
analyzer: 'ts_analyzer'
},
contents: {
type: 'text',
Expand All @@ -41,7 +41,7 @@ namespace :elasticsearch do
type: 'keyword'
}
},
analyzer: 'default'
analyzer: 'ts_analyzer'
},
grade_begin: { type: 'long' },
grade_end: { type: 'long' },
Expand Down Expand Up @@ -73,8 +73,7 @@ namespace :elasticsearch do
}
},
primary_language: {
type: 'text',
fielddata: true
type: 'keyword'
},
available_copies: { type: 'long' },
bnumber: {
Expand All @@ -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',
Expand Down
3 changes: 1 addition & 2 deletions lib/tasks/seed_teacher_sets.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 6 additions & 9 deletions script/elastic_search/create_es_index_mappings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand Down

0 comments on commit 743d4f9

Please sign in to comment.