索引信息
查看索引信息
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XGET "http://127.0.0.1:9200/db_test?pretty=true" |
搜索示例
多主键查询
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
term查询未分词的指定列
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
terms查询多个未分词的指定列
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
前缀查询
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
通配符查询(wildcard)
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
正则查询(Regex)
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
span查询
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
匹配查询
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
匹配查询多个field
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
前缀匹配查询
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
query_string查询
查询关键词同时包含”蜗牛”和”爱情” 并且评分不小于80 分类号为30的文档
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
区间查询
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
分页排序查询
分页查询所有数据,结果以更新时间降序、主键编号升序排列
1 | [root@icloud-store ~]# curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
关键词筛选查询
查询与宫崎骏
相关的作品
1 | [root@icloud-store ~]# curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |
搜索推荐查询
根据关键词进行搜索推荐(前缀匹配)
1 | [root@localhost elasticsearch-6.0.0 ]$ curl -XPOST "http://127.0.0.1:9200/db_test/tb_opus/_search?pretty=true" -H 'Content-Type: application/json' -d' |