Created
March 3, 2022 15:04
-
-
Save cbuescher/ad3fef4cfd4889afcb8e8779e300b08c to your computer and use it in GitHub Desktop.
Simple synonym example
This file contains 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
DELETE test | |
PUT /test | |
{ | |
"settings": { | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"synonym": { | |
"tokenizer": "standard", | |
"filter": [ "synonym" ] | |
} | |
}, | |
"filter": { | |
"synonym": { | |
"type": "synonym", | |
"lenient": true, | |
"synonyms": [ "car, automobile, vehicle" ] | |
} | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"properties": { | |
"message" : { | |
"type": "text", | |
"analyzer": "standard", | |
"search_analyzer": "synonym" | |
} | |
} | |
} | |
} | |
PUT /test/_doc/1 | |
{ | |
"message" : "This is a fast car." | |
} | |
POST /test/_search | |
{ | |
"query": { | |
"match": { | |
"message": "vehicle" | |
} | |
} | |
} | |
POST /test/_search | |
{ | |
"query": { | |
"match": { | |
"message": "automobile" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment