Skip to content

Commit

Permalink
script and dependance for ES index and mappings update
Browse files Browse the repository at this point in the history
  • Loading branch information
jphilou committed May 7, 2024
1 parent 24e010e commit a5da524
Show file tree
Hide file tree
Showing 13 changed files with 5,786 additions and 0 deletions.
48 changes: 48 additions & 0 deletions scripts/esUpdateMapSettings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

#installation du plugin es et reboot
#Install elastic plugin analysis-icu
echo 'Installing es plugin to elasticsearch docker'
docker exec -it v6_api-elasticsearch-1 bin/plugin install analysis-icu
echo 'Installing done - restarting es docker'
docker restart v6_api-elasticsearch-1
sleep 10 #in sec to let the docker restart

#2. closing the index to upgrade settings
echo -e '\n closing index'
curl -X POST -H "Content-Type: application/json" http://localhost:9200/c2corg/_close
sleep 2
#3. Updating analyser settings
echo -e '\n updating Settings'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/settings.json http://localhost:9200/c2corg/_settings
sleep 2
#4. restarting the index
echo -e '\n restarting index'
curl -X POST -H "Content-Type: application/json" http://localhost:9200/c2corg/_open
sleep 2
#5. Docs Mappings update
echo 'updating doc type mappings'
echo 'doc type : a'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/a.json http://localhost:9200/c2corg/_mapping/a
echo -e '\n doc type : b'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/b.json http://localhost:9200/c2corg/_mapping/b
echo -e '\n doc type : c'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/c.json http://localhost:9200/c2corg/_mapping/c
echo -e '\n doc type : i'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/i.json http://localhost:9200/c2corg/_mapping/i
echo -e '\n doc type : m'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/m.json http://localhost:9200/c2corg/_mapping/m
echo -e '\n doc type : o'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/o.json http://localhost:9200/c2corg/_mapping/o
echo -e '\n doc type : r'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/r.json http://localhost:9200/c2corg/_mapping/r
echo -e '\n doc type : u'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/u.json http://localhost:9200/c2corg/_mapping/u
echo -e '\n doc type : w'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/w.json http://localhost:9200/c2corg/_mapping/w
echo -e '\n doc type : x'
curl -X PUT -H "Content-Type: application/json" -d @./esjson/x.json http://localhost:9200/c2corg/_mapping/x
sleep 2
#6. RE-index the indice to apply mappings
echo -e '\n Indexing with new parameters - should take sometimes - pls wait server acknowlegment'
curl -X POST -H "Content-Type: application/json" http://localhost:9200/c2corg/_update_by_query?conflicts=proceed
257 changes: 257 additions & 0 deletions scripts/esjson/a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
{
"_all": {
"enabled": false
},
"properties": {
"area_type": {
"type": "string",
"index": "not_analyzed"
},
"areas": {
"type": "long"
},
"available_locales": {
"type": "string",
"index": "not_analyzed"
},
"description_ca": {
"type": "string",
"analyzer": "index_catalan",
"search_analyzer": "search_catalan"
},
"description_de": {
"type": "string",
"analyzer": "index_german",
"search_analyzer": "search_german"
},
"description_en": {
"type": "string",
"analyzer": "index_english",
"search_analyzer": "search_english"
},
"description_es": {
"type": "string",
"analyzer": "index_spanish",
"search_analyzer": "search_spanish"
},
"description_eu": {
"type": "string",
"analyzer": "index_basque",
"search_analyzer": "search_basque"
},
"description_fr": {
"type": "string",
"analyzer": "index_french",
"search_analyzer": "search_french"
},
"description_it": {
"type": "string",
"analyzer": "index_italian",
"search_analyzer": "search_italian"
},
"doc_type": {
"type": "string",
"index": "not_analyzed"
},
"geom": {
"type": "geo_point"
},
"id": {
"type": "long"
},
"quality": {
"type": "integer"
},
"summary_ca": {
"type": "string",
"analyzer": "index_catalan",
"search_analyzer": "search_catalan"
},
"summary_de": {
"type": "string",
"analyzer": "index_german",
"search_analyzer": "search_german"
},
"summary_en": {
"type": "string",
"analyzer": "index_english",
"search_analyzer": "search_english"
},
"summary_es": {
"type": "string",
"analyzer": "index_spanish",
"search_analyzer": "search_spanish"
},
"summary_eu": {
"type": "string",
"analyzer": "index_basque",
"search_analyzer": "search_basque"
},
"summary_fr": {
"type": "string",
"analyzer": "index_french",
"search_analyzer": "search_french"
},
"summary_it": {
"type": "string",
"analyzer": "index_italian",
"search_analyzer": "search_italian"
},
"title_ca": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
}
}
},
"title_ca": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "catalan_heavy"
}
}
},
"title_de": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "german_heavy"
}
}
},
"title_en": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "english_heavy"
}
}
},
"title_es": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "spanish_heavy"
}
}
},
"title_eu": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "basque_heavy"
}
}
},
"title_fr": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "french_heavy"
}
}
},
"title_it": {
"type": "string",
"index": "not_analyzed",
"fields": {
"ngram": {
"type": "string",
"analyzer": "index_ngram",
"search_analyzer": "search_ngram"
},
"raw": {
"type": "string",
"analyzer": "index_raw",
"search_analyzer": "search_raw"
},
"contentheavy": {
"type": "string",
"analyzer": "italian_heavy"
}
}
}
}
}
Loading

0 comments on commit a5da524

Please sign in to comment.