Skip to content

Commit

Permalink
test: improve es index settings and mappings (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
qloog committed Jun 27, 2023
1 parent 7482d1b commit 746b573
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions pkg/storage/elasticsearch/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,31 @@ func TestNewESClientWithContext(t *testing.T) {
func TestCreateIndex(t *testing.T) {
a := assert.New(t)
bodyStr := `{
"settings": {
"analysis": {
"analyzer": {
"nickname_analyzer": {
"type": "custom",
"tokenizer": "ngram",
"char_filter": [
"html_strip"
],
"filter": [
"lowercase",
"trim",
"unique"
]
}
},
"tokenizer": {
"ngram": {
"type": "ngram",
"min_gram": 2,
"max_gram": 20
}
}
}
},
"mappings" : {
"properties" : {
"id" : {
Expand All @@ -50,12 +75,7 @@ func TestCreateIndex(t *testing.T) {
"nickname" : {
"index": true,
"type" : "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
"analyzer": "partial"
},
"bio" : {
"index": true,
Expand Down

0 comments on commit 746b573

Please sign in to comment.