wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.zip
# zip is for Windows and Linux
unzip elasticsearch-5.4.1.zip
elasticsearch-5.4.1/bin/elasticsearch
curl -XPOST "http://localhost:9200/voxxed/doc" -d '
> {
> "title": "Hello world!",
> "content": "Hello Voxxed Days Singapore!"
> }'
curl -XPOST "http://localhost:9200/voxxed/doc/_search" -d '
> {
> "query": {
> "match": {
> "content": "Singapore"
> }
> }
> }'
{
"took" : 127,
[...]
},
"hits" : {
"total" : 1,
"max_score" : 0.2876821,
"hits" : [
{
"_index" : "voxxed",
"_type" : "doc",
"_id" : "AVwAP4Aw9lCQvRKyIhgJ",
"_score" : 0.2876821,
"_source" : {
"title" : "Hello world!",
"content" : "Hello Voxxed Days Singapore!"
}
}
]
}
}
Term | Doc Id |
---|---|
days | 1 |
hello | 1 |
singapore | 1 |
voxxed | 1 |
curl -XPUT "http://localhost:9200/voxxed_en" -d'
{
"mappings": {
"doc": {
"properties": {
"content": {
"type": "text",
"analyzer": "english"
}
}
}
}
}'
Mari kita rakyat Singapura
Sama-sama menuju bahagia
curl -XPOST "http://localhost:9200/voxxed/doc" -d'
{
"title": "Majulah Singapura",
"content": "Mari kita rakyat Singapura Sama-sama menuju bahagia"
}'
curl -XPOST "http://localhost:9200/voxxed/doc/_search" -d'
{
"query": {
"match": {
"content": "bahagia"
}
}
}'
ஆறின கஞ்சி பழங் கஞ்சிCold food is (soon) old food
{
"query": {
"match": {
"content": "கஞ்சி"
}
}
}
你好新加坡Hello Singapore
你好新加坡你好 好新 新加 加坡
{
"query": {
"match": {
"content": "新加坡"
}
}
}