Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- curl -XDELETE "http://localhost:9200/test"
- curl -XPUT "http://localhost:9200/test" -H 'Content-Type: application/json' -d'
- {
- "settings": {
- "analysis": {
- "normalizer": {
- "custom_normalizer": {
- "type": "custom",
- "char_filter": ["stopword_char_filter", "trim_char_filter"],
- "filter": ["lowercase"]
- }
- },
- "char_filter": {
- "stopword_char_filter": {
- "type": "pattern_replace",
- "pattern": "( ?und ?| ?gmbh ?)",
- "replacement": " "
- },
- "trim_char_filter": {
- "type": "pattern_replace",
- "pattern": "(\s+)$",
- "replacement": ""
- }
- }
- }
- },
- "mappings": {
- "file": {
- "properties": {
- "name": {
- "type": "keyword",
- "normalizer": "custom_normalizer"
- }
- }
- }
- }
- }'
- curl -XPOST "http://localhost:9200/test/_analyze" -H 'Content-Type: application/json' -d'
- {
- "normalizer": "custom_normalizer",
- "text": "hansel und gretel gmbh"
- }'
- curl -XPUT "http://localhost:9200/test/file/1" -H 'Content-Type: application/json' -d'
- {
- "name": "hansel und gretel gmbh"
- }'
- curl -XGET "http://localhost:9200/test/_search" -H 'Content-Type: application/json' -d'
- {
- "query": {
- "match" : {
- "name" : {
- "query" : "hansel gretel"
- }
- }
- }
- }'
Add Comment
Please, Sign In to add comment