Elasticsearch请求详解
curl -s -X PUT 'http://127.0.0.1:9200/shopping' | jq
curl -s 'http://127.0.0.1:9200/shopping' | jq
curl -s 'http://127.0.0.1:9200/_cat/indices?v'
curl -s -X POST 'http://127.0.0.1:9200/shopping/_doc' | jq
curl -s -X POST 'http://127.0.0.1:9200/shopping/_doc' -H "Content-Type: application/json" -d '{"title":"xiaomi","category":"xiaomi","images":"http://www.test.com/xm.jpg","price":3999.00}'| jq
curl -s -X POST 'http://127.0.0.1:9200/shopping/_doc/1001' -H "Content-Type: application/json" -d '{"title":"xiaomi","category":"xiaomi","images":"http://www.test.com/xm.jpg","price":3999.00}'| jq
curl -s -X POST 'http://127.0.0.1:9200/shopping/_create/1003' -H "Content-Type: application/json" -d '{"title":"xiaomi","category":"xiaomi","images":"http://www.test.com/xm.jpg","price":3999.00}'| jq
curl -s 'http://127.0.0.1:9200/shopping/_doc/1001' | jq
curl -s 'http://127.0.0.1:9200/shopping/_doc/2001' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search' | jq
curl -s -X PUT 'http://127.0.0.1:9200/shopping/_doc/1001' -H "Content-Type: application/json" -d '{"title":"xiaomi","category":"xiaomi","images":"http://www.test.com/xm.jpg","price":5999.00}'| jq
curl -s 'http://127.0.0.1:9200/shopping/_doc/1001' | jq
curl -s -X POST 'http://127.0.0.1:9200/shopping/_update/1001' -H 'Content-Type: application/json' -d '{"doc":{"title":"huawei"}}' | jq
curl -s 'http://127.0.0.1:9200/shopping/_doc/1001' | jq
curl -s -X DELETE 'http://127.0.0.1:9200/shopping/_doc/1001' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search?q=category:xiaomi' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"match":{"category":"xiaomi"}}}' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"match_all":{}}}' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"match_all":{}},"from":0,"size":1}' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"match_all":{}},"from":0,"size":1,"_source":["title"]}' | jq
curl -s 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"match_all":{}},"from":0,"size":2,"_source":["title","price"],"sort":{"price":{"order":"desc"}}}' | jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"bool":{"must":[{"match":{"category":"xiaomi"}}]}}}' | jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"bool":{"must":[{"match":{"category":"xiaomi"}},{"match":{"price":3999}}]}}}' | jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"bool":{"should":[{"match":{"category":"xiaomi"}},{"match":{"category":"huawei"}}]}}}' | jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"bool":{"should":[{"match":{"category":"xiaomi"} }, {"match":{"category":"huawei"} } ], "filter":{"range":{"price":{"gt":5000 } } } } } } '|jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"query":{"match_phrase":{"category":"xiaomi"} }, "highlight":{"fields":{"category":{} } } }' | jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"aggs":{"price_group":{"terms":{"field":"price"} } } }' | jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"aggs":{"price_group":{"terms":{"field":"price"} } }, "size":0 }'| jq
curl -s -X GET 'http://127.0.0.1:9200/shopping/_search' -H 'Content-Type: application/json' -d '{"aggs":{"price_group":{"avg":{"field":"price"} } }, "size":0 }'| jq
curl -s -X PUT 'http://127.0.0.1:9200/user'| jq
curl -s -X POST 'http://127.0.0.1:9200/user/_mapping' -H 'Content-Type: application/json' -d '{"properties":{"name":{"type":"text", "index":true }, "sex":{"type":"keyword", "index":true }, "tel":{"type":"keyword", "index":false } } }'| jq
curl -s -X PUT 'http://127.0.0.1:9200/user/_create/1001' -H 'Content-Type: application/json' -d '{"name":"xiao,mi", "sex":"man", "tel":"1111"}'| jq
curl -s 'http://127.0.0.1:9200/user/_search' -H 'Content-Type: application/json' -d '{"query":{"match":{"name":"xiao"} } }'| jq
curl -s 'http://127.0.0.1:9200/user/_search' -H 'Content-Type: application/json' -d '{"query":{"match":{"tel":"11"} } }'| jq
curl -s 'http://127.0.0.1:9200/user/_search' -H 'Content-Type: application/json' -d '{"query":{"match":{"tel":"1111"} } }'| jq
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)