ES Learning 3 DSL Summary

Source: Internet
Author: User
 Match full text receive role coding result is all role, codingHighlight highlighting FieldsAggs all_interests Aggregation Query//Cluster health green yellow red GET/_cluster/healthThe Shard can be a primary shard (primary shard) or a copy shard (Replica shard). Each document in your index belongs to a separate primary shard, so the number of primary shards determines how much data the index can store.There is no limit to the amount of data the primary shard can store, and the limit depends on your actual usage. The maximum capacity of a shard depends entirely on your usage: the size of the hardware store, the size and complexity of the document, how to index and query your document, and the response time you expect.//A copy shard is just a copy of the primary shard, which prevents data loss caused by a hardware failure, and can provide read requests such as searching or retrieving documents from other Shard.Meta data_index indexes similar databases_type Document Type Table_id ES Unique identification type number_source[query returns the specified field between fields used, split]Http://localhost:9200/domain/domain_index/_search?_source=host,idGet/website/blog/123?_source=title,text//Check if the document existsCurl-i-xhead http://localhost:9200/website/blog/123//New_createPut/website/blog/123?op_type=createPut/website/blog/123/_create//DeleteDelete/website/blog/123////Update//Post/website/blog/1/_update// {"Doc": {"Tags": ["testing"],"Views": 0//    }}//query by id DESC//size per page display number $curl _param = [' sort ' =>[' id ' =>[' Order ' = ' $sort]], ' size ' =-$size];Equivalent to COUNT ()Way One{"Aggs": {"Genres": {"Terms": {"field": "Advertiser"}}}}Way Two{"Aggs": {"Genres": {"Terms": {"Field": "Advertiser","Order": {"_count": "Desc"}},"Aggs": {"Status": {"Terms": {"Field": "Status","Order": {"_count": "Desc"}}}}}}}Mode three{"Query": {"BOOL": {"Must": {"Match": {"title": "C"}}}},"Aggs": {"Genres": {"Terms": {"field": "Advertiser"}}}}Range Range Query $curl_param = [' sort ' =>[' id ' =>[' order ' = $sort                    ]], ' size ' = $size, ' query ' =>[' bool ' =>[                                ' must ' =>[' range ' =>[' ID ' =>[            ' GT ' = $rand _id]]                     ]];//term uses the form equivalent to the SQL where id=3 $curl _param = [' sort ' =>[' id ' =>[ ' Order ' = ' desc '], ' size ' = $size, ' query ' = [' term ' =>[' platform ' = + $platform]]];/ /bool Set query//fuzzy blur query equivalent to percent $curl _param = [' sort ' =>[' id ' =>[' ord Er ' = ' desc ']           ], ' size ' = $size, ' query ' =>[' bool ' =>[' must ' =                            >[[' term ' =>[' type ' = ' $type                                ]], [' term ' =>[                    ' Platform ' = $platform]]                                ], ' should ' =>[[' Fuzzy ' =>[                            ' title ' =>[' value ' = $param]                                ]], [' Fuzzy ' =>[                                ' Domain ' =>[' value ' = $param                      ]      ]                        ]                    ]                                    ]            ]        ];                        Max min query $curl _param = [' query ' =>[' bool ' =>[' must ' =>[                ' term ' =>[' id ' = $id]]                        ]], ' Aggs ' =>[' first_detected ' =>[' min ' =>[                     ' Field ' = ' created_date '], ' last_detected ' =>[            ' Max ' =>[' field ' = ' created_date ']                    ]];//Groub by Enquiry//group_by_state $curl _param = [' query ' =>[' bool ' =>[                                ' Must ' =>[[' term ' =>[           $isfield =>1                 ]], [' term ' =>[               ' Host ' = $host]]                        ]], ' Aggs ' =>[' group_by_state ' =>[' terms ' =>[  ' Field ' = $field]]]];//multi-field query $curl _param =            [' Sort ' =>[' id ' =>[' order ' = ' desc ']], ' Query ' =>[' multi_match ' =>[' query ' = $title, ' Typ                    E ' = ' best_fields ', ' Fields ' =>[' title ', ' domain ', ' keywords '                            ], ' Tie_breaker ' =>0.3, ' minimum_should_match ' = ' 30% '] ]        ];//filter filtering uses $curl_param = [' sort ' =>[' id ' = ' desc '],                            ' Query ' =>[' filtered ' =>[' filter ' =>[' range ' =>[ ' ID ' =>[' GTE ' = $min _id, ' LTE '        = $max _id]] []]  ];            $curl _param = [' sort ' =>[' id ' =>[' order ' = ' desc '] ], ' size ' = $size, ' query ' =>[' bool ' =>[' must ' =& Gt                            [' Fuzzy ' =>[' title ' = ' $param                     ]], [' term ' =>[           ' Type ' = $type]], [                        ' Term ' =>[' platform ' = $platform] ], [' term ' =>[' shape ' =&gt ; $shape]], [' Range '                                    =>[' created_date ' =>[' gte ' = $startTime,                        ' LT ' = $endTime]]                                    ], [' Range ' =>[' ID ' =>[                        ' GTE ' = $last _id]]      ]                                      ]                                    ]            ]        ];  should using//foreach ($param as $key + = $value) {if ($value) {$should _arr[]            = [' term ' =>[' id ' = ' + $value]];                    }} $curl _param = [' query ' =>[' bool ' =>[ ' Should ' = $should _arr]];

The above describes the ES Learning 3 DSL Summary, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.