Created
March 7, 2016 16:25
-
-
Save jprante/10f6f25b9724c6c54a0d to your computer and use it in GitHub Desktop.
I love ES Pt. 2
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": { | |
"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