Created
February 2, 2018 14:41
-
-
Save kcleong/b6b0758de740ca6a5acde93a15518e70 to your computer and use it in GitHub Desktop.
Dutch language analyzer in Elasticsearch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT ham | |
{ | |
"mappings": { | |
"doc": { | |
"properties": { | |
"created": { | |
"type": "date" | |
}, | |
"title": { | |
"type": "text", | |
"fields": { | |
"dutch": { | |
"type": "text", | |
"analyzer": "dutchy" | |
} | |
} | |
}, | |
"description": { | |
"type": "text", | |
"analyzer": "dutchy" | |
} | |
} | |
} | |
}, | |
"settings": { | |
"analysis": { | |
"filter": { | |
"dutch_stop": { | |
"type": "stop", | |
"stopwords": "_dutch_" | |
}, | |
"dutch_kp_stemmer": { | |
"type": "stemmer", | |
"language": "dutch_kp" | |
}, | |
"dutch_override": { | |
"type": "stemmer_override", | |
"rules": [ | |
"calamiteiten=>calamiteit", | |
"calamiteit=>calamiteit", | |
"konijn=>lindelaan" | |
] | |
} | |
}, | |
"analyzer": { | |
"dutchy": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"lowercase", | |
"dutch_stop", | |
"dutch_override", | |
"dutch_kp_stemmer" | |
] | |
} | |
} | |
} | |
} | |
} | |
GET ham/_settings | |
PUT ham/doc/bla | |
{ | |
"title": "de artikeltje met vele calamiteiten, en grote zaken. scholen", | |
"created": "2018-02-02T12:00:00" | |
} | |
PUT ham/doc/vla | |
{ | |
"title": "leentje leerde lotje lopen langs de lange lindelaan", | |
"created": "2018-02-02T12:00:00" | |
} | |
GET ham/doc/bla/ | |
GET ham/doc/bla/_explain | |
{ | |
"query": { | |
"query_string": { | |
"query": "lotje", | |
"analyzer": "dutchy" | |
} | |
} | |
} | |
} | |
GET ham/_search?pretty | |
{ | |
"query": { | |
"query_string": { | |
"query": "konijn", | |
"analyzer": "dutchy" | |
} | |
} | |
} | |
} | |
GET ham/_analyze | |
{ | |
"analyzer" : "dutchy", | |
"text" : "leentje leerde lotje lopen langs de lange lindelaan" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment