Skip to content

Instantly share code, notes, and snippets.

@jprante
Created March 7, 2016 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jprante/10f6f25b9724c6c54a0d to your computer and use it in GitHub Desktop.
Save jprante/10f6f25b9724c6c54a0d to your computer and use it in GitHub Desktop.
I love ES Pt. 2
DELETE /test
PUT /test/
{
"settings": {
"analysis": {
"filter" : {
"heart" : {
"type" : "synonym",
"synonyms" : [
"❤ => love,❤,<3",
"<3 => love,❤,<3",
"love => love,❤,<3"
]
}
},
"analyzer": {
"myanalyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter" : [
"lowercase",
"heart"
]
}
}
}
},
"mappings": {
"doc": {
"properties": {
"text": {
"type": "string",
"analyzer": "myanalyzer"
}
}
}
}
}
PUT /test/doc/1
{
"text" : "I <3 ES"
}
PUT /test/doc/2
{
"text" : "I ❤ ES"
}
PUT /test/doc/3
{
"text" : "I love ES"
}
POST /test/doc/_search
{
"query" : {
"match" : {
"text" : "❤"
}
}
}
POST /test/doc/_search
{
"query" : {
"match" : {
"text" : "love"
}
}
}
POST /test/doc/_search
{
"query" : {
"match" : {
"text" : "<3"
}
}
}
POST /test/_analyze
{
"analyzer" : "myanalyzer",
"text": "<3"
}
POST /test/_analyze
{
"analyzer" : "myanalyzer",
"text": "❤"
}
POST /test/_analyze
{
"analyzer" : "myanalyzer",
"text": "love"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment