Skip to content

Commit

Permalink
Rename indexer mapping to content mapping to be consistent with OS_In…
Browse files Browse the repository at this point in the history
…dexInit.sh; Add mapping files and OS_IndexInit.sh to archetype to have it in a generated project without the need to copy paste from the SC OS Jar file _or_ copy paste from soure. Update archetype xml config to include *.sh and *.mapping

Signed-off-by: Richard Zowalla <[email protected]>
  • Loading branch information
rzo1 committed Mar 22, 2024
1 parent 04e711d commit 06e9137
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

OSHOST=${1:-"http://localhost:9200"}
OSCREDENTIALS=${2:-"-u opensearch:passwordhere"}

for name in status content
do
curl $OSCREDENTIALS -s -XDELETE "$OSHOST/$name/" > /dev/null
echo "Deleted '$name' index, now recreating it..."
curl $OSCREDENTIALS -s -XPUT "$OSHOST/$name" -H 'Content-Type: application/json' --upload-file src/main/resources/$name.mapping
echo ""
done

### metrics

curl $OSCREDENTIALS -s -XDELETE "$OSHOST/metrics*/" > /dev/null

echo "Deleted 'metrics' index, now recreating it..."

# http://localhost:9200/metrics/_mapping/status?pretty
curl $OSCREDENTIALS -s -XPOST "$OSHOST/_template/metrics-template" -H 'Content-Type: application/json' --upload-file src/main/resources/metrics.mapping

echo ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"index_patterns": "metrics*",
"settings": {
"index": {
"number_of_shards": 1,
"refresh_interval": "30s"
},
"number_of_replicas": 0
},
"mappings": {
"_source": { "enabled": true },
"properties": {
"name": {
"type": "keyword"
},
"stormId": {
"type": "keyword"
},
"srcComponentId": {
"type": "keyword"
},
"srcTaskId": {
"type": "short"
},
"srcWorkerHost": {
"type": "keyword"
},
"srcWorkerPort": {
"type": "integer"
},
"timestamp": {
"type": "date",
"format": "date_optional_time"
},
"value": {
"type": "double"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"settings": {
"index": {
"number_of_shards": 10,
"number_of_replicas": 1,
"refresh_interval": "5s"
}
},
"mappings": {
"dynamic_templates": [{
"metadata": {
"path_match": "metadata.*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}],
"_source": {
"enabled": true
},
"properties": {
"key": {
"type": "keyword",
"index": true
},
"nextFetchDate": {
"type": "date",
"format": "date_optional_time"
},
"status": {
"type": "keyword"
},
"url": {
"type": "keyword"
}
}
}
}
40 changes: 40 additions & 0 deletions external/opensearch/src/main/resources/content.mapping
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1,
"refresh_interval": "60s"
}
},
"mappings": {
"_source": {
"enabled": true
},
"properties": {
"content": {
"type": "text"
},
"description": {
"type": "text"
},
"domain": {
"type": "keyword"
},
"format": {
"type": "keyword"
},
"keywords": {
"type": "keyword"
},
"host": {
"type": "keyword"
},
"title": {
"type": "text"
},
"url": {
"type": "keyword"
}
}
}
}

0 comments on commit 06e9137

Please sign in to comment.