Move Elasticsearch mappings to config folder as json file (#6051) [deploy]

This commit is contained in:
Molly Struve 2020-02-13 11:33:47 -05:00 committed by GitHub
parent 0bfbd9bb1f
commit 9f4dad77da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 28 deletions

View file

@ -2,6 +2,7 @@ module Search
class Tag
INDEX_NAME = "tags_#{Rails.env}".freeze
INDEX_ALIAS = "tags_#{Rails.env}_alias".freeze
MAPPING = JSON.parse(File.read("config/elasticsearch/mappings/tags.json"), symbolize_names: true).freeze
class << self
def index(tag_id, serialized_data)
@ -53,34 +54,7 @@ module Search
end
def mappings
{
dynamic: "strict",
properties: {
id: {
type: "keyword"
},
name: {
type: "text",
fields: {
raw: {
type: "keyword"
}
}
},
hotness_score: {
type: "integer"
},
supported: {
type: "boolean"
},
short_summary: {
type: "text"
},
rules_html: {
type: "text"
}
}
}
MAPPING
end
end
end

View file

@ -0,0 +1,28 @@
{
"dynamic": "strict",
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
}
},
"hotness_score": {
"type": "integer"
},
"supported": {
"type": "boolean"
},
"short_summary": {
"type": "text"
},
"rules_html": {
"type": "text"
}
}
}