Skip to content

Instantly share code, notes, and snippets.

@TomonoriSoejima
Last active September 22, 2017 03:14
Show Gist options
  • Save TomonoriSoejima/300ea259bd31be66d57625be2823e885 to your computer and use it in GitHub Desktop.
Save TomonoriSoejima/300ea259bd31be66d57625be2823e885 to your computer and use it in GitHub Desktop.
kuromoji with phrase test on 5.x
GET _cat/plugins/
# settings
PUT /kuro/
{
"settings": {
"index":{
"analysis":{
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "kuromoji_tokenizer",
"filter" : ["kuromoji_baseform"]
}
}
}
}
}
}
POST kuro/_analyze
{
"analyzer": "my_analyzer",
"text": "紅茶を飲む"
}
PUT kuro/doc/1
{
"title": "紅茶飲む"
}
PUT kuro/doc/2
{
"title": "紅茶にミルクを入れる"
}
PUT kuro/doc/3
{
"title": "紅茶に沖縄県から届いたミルクを入れる"
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"operator": "and",
"query": "紅茶飲む"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"query": "紅茶にミルク"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"query": "紅茶がミルク"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"query": "紅茶 ミルク"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"query": "紅茶にはミルク"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"operator": "or",
"query": "紅茶がミルク",
"type" : "phrase"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"operator": "or",
"query": "紅茶 ミルク",
"type" : "phrase"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"operator": "or",
"query": "紅茶にはミルク",
"type" : "phrase"
}
}
}
}
GET /kuro/_search
{
"query": {
"match": {
"title": {
"query": "紅茶 ミルク",
"type" : "phrase",
"slop" : 10
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment