Move Elasticsearch mappings to config folder as json file (#6051) [deploy]
This commit is contained in:
parent
0bfbd9bb1f
commit
9f4dad77da
2 changed files with 30 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
28
config/elasticsearch/mappings/tags.json
Normal file
28
config/elasticsearch/mappings/tags.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue