Skip to content

Commit

Permalink
Update to go 1.16, use embedded file for index settings, remove no lo…
Browse files Browse the repository at this point in the history
…nger used is_blocked and and is_stopped fields
  • Loading branch information
rowanseymour committed Jul 29, 2021
1 parent d66e01a commit db35672
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 256 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI
on: [push, pull_request]
env:
go-version: '1.16.x'
es-version: '7.10.1'
jobs:
test:
name: Test
Expand All @@ -14,7 +17,7 @@ jobs:
- name: Install ElasticSearch
uses: nyaruka/elasticsearch-action@master
with:
elastic version: '7.10.1'
elastic version: ${{ env.es-version }}

- name: Install PostgreSQL
uses: harmon758/postgresql-action@v1
Expand All @@ -27,7 +30,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.15.x
go-version: ${{ env.go-version }}

- name: Run tests
run: go test -p=1 -coverprofile=coverage.text -covermode=atomic ./...
Expand All @@ -50,7 +53,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.15.x
go-version: ${{ env.go-version }}

- name: Publish release
uses: goreleaser/goreleaser-action@v1
Expand Down
183 changes: 183 additions & 0 deletions contacts/index_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"settings": {
"index": {
"number_of_shards": 2,
"number_of_replicas": 1,
"routing_partition_size": 1
},
"analysis": {
"analyzer": {
"trigrams": {
"type": "custom",
"tokenizer": "trigram",
"filter": [
"lowercase"
]
},
"locations": {
"tokenizer": "location_tokenizer",
"filter": [
"lowercase",
"word_delimiter"
]
},
"prefix": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"prefix_filter"
]
},
"name_search": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"max_length"
]
}
},
"tokenizer": {
"location_tokenizer": {
"type": "pattern",
"pattern": "(.* > )?([^>]+)",
"group": 2
},
"trigram": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3
}
},
"normalizer": {
"lowercase": {
"type": "custom",
"char_filter": [],
"filter": [
"lowercase",
"trim"
]
}
},
"filter": {
"prefix_filter": {
"type": "edge_ngram",
"min_gram": 2,
"max_gram": 8
},
"max_length": {
"type": "truncate",
"length": 8
}
}
}
},
"mappings": {
"_doc": {
"_routing": {
"required": true
},
"properties": {
"fields": {
"type": "nested",
"properties": {
"field": {
"type": "keyword"
},
"text": {
"type": "keyword",
"normalizer": "lowercase"
},
"number": {
"type": "scaled_float",
"scaling_factor": 10000
},
"datetime": {
"type": "date"
},
"state": {
"type": "text",
"analyzer": "locations"
},
"state_keyword": {
"type": "keyword",
"normalizer": "lowercase"
},
"district": {
"type": "text",
"analyzer": "locations"
},
"district_keyword": {
"type": "keyword",
"normalizer": "lowercase"
},
"ward": {
"type": "text",
"analyzer": "locations"
},
"ward_keyword": {
"type": "keyword",
"normalizer": "lowercase"
}
}
},
"urns": {
"type": "nested",
"properties": {
"path": {
"type": "text",
"analyzer": "trigrams",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase"
}
}
},
"scheme": {
"type": "keyword",
"normalizer": "lowercase"
}
}
},
"groups": {
"type": "keyword"
},
"uuid": {
"type": "keyword"
},
"status": {
"type": "keyword"
},
"language": {
"type": "keyword",
"normalizer": "lowercase"
},
"modified_on": {
"type": "date"
},
"created_on": {
"type": "date"
},
"modified_on_mu": {
"type": "long"
},
"last_seen_on": {
"type": "date"
},
"name": {
"type": "text",
"analyzer": "prefix",
"search_analyzer": "name_search",
"fields": {
"keyword": {
"type": "keyword",
"normalizer": "lowercase"
}
}
}
}
}
}
}
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ require (
github.com/nyaruka/ezconf v0.2.1
github.com/nyaruka/gocommon v1.3.0
github.com/olivere/elastic/v7 v7.0.22
github.com/onsi/ginkgo v1.14.0 // indirect
github.com/sirupsen/logrus v1.0.5
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.5.1
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
)

go 1.13
go 1.16
Loading

0 comments on commit db35672

Please sign in to comment.