Skip to content

Instantly share code, notes, and snippets.

@jamesgorrie
Last active April 9, 2021 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesgorrie/a1f7de9fa2fe910fc6bc206a1c6dd365 to your computer and use it in GitHub Desktop.
Save jamesgorrie/a1f7de9fa2fe910fc6bc206a1c6dd365 to your computer and use it in GitHub Desktop.
PUT test
{
"settings": {
"analysis": {
"analyzer": {
"standard_shingle": {
"tokenizer": "standard",
"filter": [ "shingle" ]
}
}
}
},
"mappings": {
"properties": {
"title": {
"type": "text",
"fields": {
"shingle": {
"type": "text",
"analyzer": "standard_shingle"
}
}
}
}
}
}
GET test/_search
{
"query": {
"fuzzy": {
"title.shingle": {
"value": "text books"
}
}
}
}
GET test/_search
{
"query": {
"fuzzy": {
"title.shingle": {
"value": "textbooks"
}
}
}
}
GET test/_search
{
"query": {
"multi_match": {
"fields": ["title.shingle"],
"query": "text books",
"fuzziness": "auto"
}
}
}
GET test/_search
{
"query": {
"multi_match": {
"fields": ["title.shingle"],
"query": "textbooks",
"fuzziness": "auto"
}
}
}
PUT test/_doc/1
{
"title": "textbooks"
}
PUT test/_doc/2
{
"title": "text books"
}
PUT test/_doc/3
{
"title": "textabooks"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment