<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # elasticsearch語法 ### 相關網站 - [官方文檔](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html) - [mapping詳解](https://zq99299.github.io/note-book/elasticsearch-core/search-engine/44-mapping-detailed.html) - [檢索技巧](https://learnku.com/elasticsearch/t/47787) ### 命令列表 > GET /_cat ### 所有索引信息 > GET /_cat/indices?v > GET /_cat/indices/your_index_prefix*?v=true ### param參數 > [cat.asciidoc](https://github.com/elastic/elasticsearch/blob/main/docs/reference/cat.asciidoc) ```bash GET _cat/indices/so_alert*?format=json&s=creation.date.string:desc&bytes=b&h=health,status,index,uuid,pri,rep,docs.count,docs.deleted,store.size,pri.store.size,creation.date.string ``` ### 字段過濾&排序 ```bash GET /your_index_name/_search?_source=title,name,content&sort=id:desc { "query": { "match_all": {} }, "from": 0, "size": 10 } ``` ### sql查詢 ```bash POST _plugins/_sql { "query": "SELECT class_id,alert_rules_name FROM so_alert LIMIT 10" } ``` ### 節點信息(版本) > GET /_nodes ### 查詢全部 > GET /your_index_prefix*/_search ```bash GET /your_index_prefix*/_search { "query": { "match_all": {} } } ``` ### 分頁查找 ```bash GET /your_index_name/_search { "query": { "match_all": {} }, "from": 0, "size": 10 } ``` ### 滾動分頁 ```bash GET /your_index_name/_search?scroll=1m { "query": { "match_all": {} } } ``` ```bash GET /_search/scroll { "scroll": "1m", "scroll_id" : "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFG93THVKSVVCZy1tZzVha2xlbEk0AAAAAAACHGQWaDhWTmdjblNRTDJjV1pFZFBBc2cyZw==" } ``` ### 布爾查詢 - 嵌套must嵌入should查詢:滿足且A或B條件 ```bash GET /your_index_name/_search { "query": { "bool": { "must": [ { "match": { "field1": "公共機構" } }, { "bool": { "should": [ { "prefix": { "field2": "52" } }, { "match": { "field2": "" } } ] } } ], "must_not": [ { "match": { "field1": "事業部" } } ] } } } ``` ### 使用operator匹配所有分詞 ```bash GET /your_index_name/_search { "query": { "match": { "title": { "query": "搜索引擎知識", "operator": "and" } } } } ``` ### 精確查找 ```bash GET /your_index_name/_search { "query": { "term": { "userName": "jack" } }, "size": 10 } ``` ### 按時間查找 ```bash GET /your_index_name/_search { "query": { "bool": { "filter": [ { "range": { "update_time": { "gte": "2023-05-07 21:18:25" } } } ] } } } ``` ### 聚合查詢 ```bash GET /your_index_name/_search { "size": 0, "aggs": { "indexs": { "terms": { "field": "index_code.keyword", "order": { "maxValue": "asc" }, "size": 3 }, "aggs": { "maxValue": { "sum": { "field": "online_count" } } } } } } ``` ### 匹配結果解釋分析 ```bash GET /your_index*/_search { "explain": true, "query": { "bool": { "must": [ { "match": { "title": "your keywords" } } ] } } } ``` ### 檢索分析 > GET /_analyze ```bash GET /your_index_name/_analyze { "field": "your_field_name", "text": "2022年年度檢查報告說明" } ``` ### 設置所有搜索此索引的最大值(默認10000) ```bash PUT /_all/_settings?preserve_existing=true { "index.max_result_window": "100000" } ``` ### index數據量 > GET /your_index_name/_count ### index是否存在 > HEAD /your_index_name ### 獲取index的mapping > GET /your_index_name > GET /your_index_name/_mapping ### 復制index ```bash POST /_reindex { "source": { "index": "your_index_a" }, "dest": { "index": "your_index_b" } } ``` ### 通過mapping創建index > [設置settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html) ```bash PUT /your_index_name { "settings": { "number_of_shards": 1, "number_of_replicas": 0, "index.max_result_window": "1000000" }, "mappings": { "properties": { "id": { "type": "long" }, "alert_id": { "type": "long" }, "created_by": { "type": "keyword" }, "created_at": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd||yyyy/MM/dd||epoch_second", "ignore_malformed": true }, "updated_by": { "type": "keyword" }, "updated_at": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd||yyyy/MM/dd||epoch_second", "ignore_malformed": true }, "time": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd||yyyy/MM/dd||epoch_second", "ignore_malformed": true } } } } ``` ### 刪除index > DELETE /your_index_name ### 模板操作 - 查看所有模板 ```bash GET /_cat/templates ``` ```bash GET /_cat/templates/myhello* ``` - 查看指定模板 ```bash GET /_index_template/myhello_template ``` - 刪除指定模板 ```bash DELETE _index_template/myhello_template ``` - 查看具體模板配置 ```bash GET /_index_template/myhello_template ``` - 新增/更新模板 ```bash PUT /_index_template/myhello_template { "index_patterns": [ "myhello_*" ], "template": { "settings": { "number_of_shards": 1, "number_of_replicas": 0, "index.max_result_window": "1000000" }, "mappings": { "properties": { "id": { "type": "long" }, "alert_id": { "type": "long" }, "created_by": { "type": "keyword" }, "created_at": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd||yyyy/MM/dd||epoch_second", "ignore_malformed": true }, "updated_by": { "type": "keyword" }, "updated_at": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd'T'HH:mm:ssZ||yyyy-MM-dd'T'HH:mm:ss.SSSZ||yyyy-MM-dd||yyyy/MM/dd||epoch_second", "ignore_malformed": true } } } } } ``` ### 解除索引只讀狀態問題 ```bash GET /your_index_name/_settings?pretty ``` 返回的數據 ```json { "your_index_name" : { "settings" : { "index" : { "number_of_shards" : "1", "blocks" : { "read_only_allow_delete" : "true" }, "provided_name" : "your_index_name", "creation_date" : "1700202922646", "number_of_replicas" : "1", "uuid" : "cJwxTNOaQDuwpYSXkWxqIA", "version" : { "created" : "135248327" } } } } } ``` > 如果出現 `"read_only_allow_delete" : "true"`,則表示該索引只讀 解除所有索引只讀狀態 ```bash PUT /_all/_settings { "settings": { "index.blocks.read_only_allow_delete": null } } ``` ### 控制腳本編譯的頻率 - 查看opensearch設置 ```bash GET _cluster/settings?include_defaults=true ``` - 修改控制腳本編譯的頻率 > 默認: 75/5m ```bash PUT _cluster/settings { "persistent": { "script.context.filter.max_compilations_rate": "75/1m" } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看