Created
February 7, 2012 11:44
-
-
Save kimchy/1759303 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
curl -XPUT localhost:9200/test -d ' | |
{ | |
"settings" : { | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"manualindexanalyzer": { | |
"type": "custom", | |
"tokenizer": "whitespace", | |
"filter": [ | |
"lowercase", | |
"asciifolding", | |
"length", | |
"myelision" | |
], | |
"char_filter": [ | |
"html_strip" | |
] | |
}, | |
"manualsearchanalyzer": { | |
"type": "custom", | |
"tokenizer": "whitespace", | |
"filter": [ | |
"lowercase", | |
"asciifolding", | |
"length", | |
"myelision" | |
], | |
"char_filter": [ | |
"html_strip" | |
] | |
} | |
}, | |
"filter": { | |
"myelision": { | |
"type": "elision", | |
"articles": ["l", "m", "t", "qu", "n", "s", "j"] | |
} | |
} | |
} | |
} | |
}, | |
"mappings" : { | |
"my_type" : { | |
"index_analyzer" : "manualindexanalyzer", | |
"search_analyzer" : "manualsearchanalyzer" | |
} | |
} | |
}' | |
curl localhost:9200/test/_analyze?analyzer=manualindexanalyzer -d 'l’avion' | |
curl localhost:9200/test/my_type/1 -d '{ | |
"my_field" : "l’avion" | |
}' | |
curl -XPOST localhost:9200/test/_refresh | |
# With my_type in search | |
curl localhost:9200/test/my_type/_search?pretty=1 -d '{ | |
"query" : { | |
"query_string" : { | |
"query" : "l’avion" | |
} | |
} | |
}' | |
# Without my_type in search | |
curl localhost:9200/test/my_type/_search?pretty=1 -d '{ | |
"query" : { | |
"query_string" : { | |
"default_field" : "my_field", | |
"query" : "l’avion" | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment