Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from kids-first/ngram
Browse files Browse the repository at this point in the history
✨Add ngram tokenizer to make "starts-with" queries
  • Loading branch information
Jeremy Costanza authored Jan 3, 2020
2 parents 4f81c26 + ef756f8 commit 26ddd94
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions mapping.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
MEMBER_INDEX = {
"settings": {
"analysis": {
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"edge_ngram"
]
}
},
"filter": {
"edge_ngram": {
"type": "edgeNGram",
"min_gram": 1,
"max_gram": 20,
"side": "front"
}
}
}
},
"mappings": {
"member": {
"properties": {
Expand Down Expand Up @@ -27,6 +49,7 @@
},
"firstName": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -35,6 +58,7 @@
},
"lastName": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -43,6 +67,7 @@
},
"jobTitle": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -51,6 +76,7 @@
},
"institution": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -59,6 +85,7 @@
},
"city": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -67,6 +94,7 @@
},
"state": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -75,6 +103,7 @@
},
"country": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -85,13 +114,16 @@
"type": "keyword"
},
"bio": {
"type": "text"
"type": "text",
"analyzer": "autocomplete"
},
"story": {
"type": "text"
"type": "text",
"analyzer": "autocomplete"
},
"interests": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -106,6 +138,7 @@
},
"name": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand All @@ -120,6 +153,7 @@
"properties": {
"name": {
"type": "text",
"analyzer": "autocomplete",
"fields": {
"raw": {
"type": "keyword"
Expand Down

0 comments on commit 26ddd94

Please sign in to comment.