Created
April 10, 2016 20:14
-
-
Save jprante/e8f8a8a712b21bf90b48e1b99ef973c7 to your computer and use it in GitHub Desktop.
Arabic text with Elasticsearch
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
DELETE /test | |
PUT /test | |
POST /test/doc/_mapping | |
{ | |
"properties": { | |
"message": { | |
"type": "string", "analyzer" : "simple" | |
} | |
} | |
} | |
POST /test/_analyze?field=message&text=%d8%a7%d9%8a%d9%82%d8%a7%d8%b9%20%d8%ae%d8%a7%d9%84 | |
{ | |
"tokens": [ | |
{ | |
"token": "ايقاع", | |
"start_offset": 0, | |
"end_offset": 5, | |
"type": "word", | |
"position": 0 | |
}, | |
{ | |
"token": "خال", | |
"start_offset": 6, | |
"end_offset": 9, | |
"type": "word", | |
"position": 1 | |
} | |
] | |
} | |
PUT /test/doc/1 | |
{ | |
"message" : "ايقاع خالي" | |
} | |
POST /test/doc/_search | |
{ | |
"query" : { | |
"match" : { | |
"message" : "ايقاع خالي" | |
} | |
} | |
} | |
{ | |
"took": 8, | |
"timed_out": false, | |
"_shards": { | |
"total": 5, | |
"successful": 5, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 1, | |
"max_score": 0.51623213, | |
"hits": [ | |
{ | |
"_index": "test", | |
"_type": "doc", | |
"_id": "1", | |
"_score": 0.51623213, | |
"_source": { | |
"message": "ايقاع خالي" | |
} | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment