标签:elasticsea
https://www.youtube.com/watch?v=60UsHHsKyN4
http://java.dzone.com/articles/first-step-spring-boot-and
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-nosql.html
C:
curl -XPUT localhost:9200/megacorp/employee/1 -d ‘{“name”:”charlie”}’
R:
curl -XGET localhost:9200/megacorp/employee/1
U:
curl -XPOST localhost:9200/megacorp/employee/1 -d ‘{“last_name”:”peng”}’
D:
curl -DELETE localhost:9200/megacorp/employee/1
在基础的CRUD之后,ElasticSearch提供了强大的搜索功能。
搜索的时候,其实是发送一个json数据到一个url,然后这个json数据包里面包含了搜索条件。
curl -XGET localhost:9200/magacorp/employee/_search?pretty -d ‘{“query”:{“match”:{“last_name”:”huang”}}}’
这里的json称谓DSL,就是所谓的Domain Specific Language
更复杂的DSL如下,
{
“query” : {
“filtered” : {
“filter” : {
“range” : {
“age” : { “gt” : 30 }
}
},
“query” : {
“match” : {
“last_name” : “Smith”
}
}
}
}
全文搜索:
{
“query” : {
“match” : { “last_name” : “John Smith”}
}
}
这个会根据搜索评分按顺序给出反馈
{
“query” : {
“match_phrase” : { “last_name” : “John Smith”}
}
}
这个会精确搜过该phrase
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:elasticsea
原文地址:http://blog.csdn.net/hyichao_csdn/article/details/46700253