<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 解釋器 原文鏈接 : [http://zeppelin.apache.org/docs/0.7.2/interpreter/elasticsearch.html](http://zeppelin.apache.org/docs/0.7.2/interpreter/elasticsearch.html) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=10030782](http://www.apache.wiki/pages/viewpage.action?pageId=10030782) 貢獻者 : [片刻](/display/~jiangzhonglian) [ApacheCN](/display/~apachecn) [Apache中文網](/display/~apachechina) ## 概述 [Elasticsearch](https://www.elastic.co/products/elasticsearch)是一個高度可擴展的開源全文搜索和分析引擎。它允許您快速,實時地存儲,搜索和分析大量數據。它通常用作為具有復雜的搜索功能和要求的應用程序提供的底層引擎/技術。 ## 配置 | 屬性 | 默認 | 描述 | | --- | --- | --- | | elasticsearch.cluster.name | elasticsearch | 群集名稱 | | elasticsearch.host | localhost | 集群中節點的主機 | | elasticsearch.port | 9300 | 連接端口**(重要提示:它取決于客戶端類型,傳輸或http)** | | elasticsearch.client.type | transport | Elasticsearch(transport或http)的客戶端類型**(Important:端口取決于此值)** | | elasticsearch.basicauth.username | ? | 基本認證用戶名(http) | | elasticsearch.basicauth.password | ? | 基本認證密碼(http) | | elasticsearch.result.size | 10 | 搜索查詢結果集的大小 | ![](https://img.kancloud.cn/ee/64/ee64f1ad69f91df72df6b7025e73e353_566x327.jpg) > **注意#1:**您可以添加更多屬性來配置Elasticsearch客戶端。 > > **注意#2:**如果使用Shield,您可以添加一個名稱為`shield.user`包含名稱和密碼(格式:)的值的屬性`username:password`。有關Shield配置的更多詳細信息,請參閱[Shield參考指南](https://www.elastic.co/guide/en/shield/current/_using_elasticsearch_java_clients_with_shield.html)。不要忘記,在解釋器目錄(`ZEPPELIN_HOME/interpreters/elasticsearch`)中復制屏蔽客戶端jar?。 ## 啟用彈性搜索解釋器 在筆記本中,要啟用**彈性搜索解釋器**,請單擊**齒輪**圖標,然后選擇**彈性搜索**。 ## 使用彈性搜索解釋器 在段落中,用于`%elasticsearch`選擇Elasticsearch解釋器,然后輸入所有命令。要獲取可用命令的列表,請使用`help`。 ``` %elasticsearch help Elasticsearch interpreter: General format: <command> /<indices>/<types>/<id> <option> <JSON> - indices: list of indices separated by commas (depends on the command) - types: list of document types separated by commas (depends on the command) Commands: - search /indices/types <query> . indices and types can be omitted (at least, you have to provide '/') . a query is either a JSON-formatted query, nor a lucene query - size <value> . defines the size of the result set (default value is in the config) . if used, this command must be declared before a search command - count /indices/types <query> . same comments as for the search - get /index/type/id - delete /index/type/id - index /index/type/id <json-formatted document> . the id can be omitted, elasticsearch will generate one ? ``` > **提示:**使用(Ctrl +。)進行自動完成。 ### 得到 使用`get`命令,您可以通過ID查找文檔。結果是一個JSON文檔。 ``` %elasticsearch get /index/type/id ? ``` 例:? ![](https://img.kancloud.cn/14/e4/14e48dd54a1b9e364dbd013f7914e2f8_566x139.jpg) ### 搜索 使用該`search`命令,您可以向Elasticsearch發送搜索查詢。有兩種查詢格式: * 您可以提供JSON格式的查詢,這正是您在使用Elasticsearch的REST API時提供的。 * 有關搜索查詢的內容的詳細信息,請參閱[Elasticsearch搜索API參考文檔](https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html)。 * 您還可以提供a的內容`query_string`。 * 這是一個查詢的快捷方式:?`{ "query": { "query_string": { "query": "__HERE YOUR QUERY__", "analyze_wildcard": true } } }` * 有關[此類查詢](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax)的內容的詳細信息,請參閱[Elasticsearch查詢字符串語法](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax)。 ``` %elasticsearch search /index1,index2,.../type1,type2,... <JSON document containing the query or query_string elements> ? ``` 如果要修改結果集的大小,可以在搜索命令之前添加一個設置大小的行。 ``` %elasticsearch size 50 search /index1,index2,.../type1,type2,... <JSON document containing the query or query_string elements> ? ``` > 搜索查詢還可以包含[聚合](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html)。如果至少有一個聚合,則顯示第一個聚合的結果,否則顯示搜索命中。 例子: * 使用JSON查詢: ``` %elasticsearch search / { "query": { "match_all": { } } } %elasticsearch search /logs { "query": { "query_string": { "query": "request.method:GET AND status:200" } } } %elasticsearch search /logs { "aggs": { "content_length_stats": { "extended_stats": { "field": "content_length" } } } }? ``` * 使用query_string元素: ``` %elasticsearch search /logs request.method:GET AND status:200 %elasticsearch search /logs (404 AND (POST OR DELETE))? ``` > **重要提示**:Elasticsearch中的文檔是一個JSON文檔,因此它是層次結構的,而不是SQL表中的一行。對于彈性解釋器,搜索查詢的結果是平坦的。 假設我們有一個JSON文檔: ``` { "date": "2015-12-08T21:03:13.588Z", "request": { "method": "GET", "url": "/zeppelin/4cd001cd-c517-4fa9-b8e5-a06b8f4056c4", "headers": [ "Accept: *.*", "Host: apache.org"] }, "status": "403", "content_length": 1234 } ? ``` 數據將如下所示: | CONTENT_LENGTH | 日期 | request.headers [0] | request.headers [1] | request.method | request.url | 狀態 | | --- | --- | --- | --- | --- | --- | --- | | 1234 | 2015-12-08T21:03:13.588Z | Accept: *.* | Host: apache.org | GET | /zeppelin/4cd001cd-c517-4fa9-b8e5-a06b8f4056c4 | 403 | 例子: * 包含結果的表格: ![](https://img.kancloud.cn/55/e8/55e8ede592fcebe16299a7ce3615f584_566x168.jpg) * 您還可以使用預定義的圖表:? ![](https://img.kancloud.cn/04/6b/046ba80e64eb8fcf81ceb52a3da1ee03_566x414.jpg) * 使用JSON查詢: ![](https://img.kancloud.cn/c6/e4/c6e4f9303ab83f9323e9fa3dca4b8ccb_566x257.jpg) * 使用包含`fields`參數(用于過濾響應中的字段)的JSON查詢:在這種情況下,響應中的所有字段值都是數組,因此,在平坦化結果之后,所有字段名稱的格式為`field_name[x]`? ![](https://img.kancloud.cn/19/5f/195f876066c968b68be5092eefb2ed91_566x312.jpg) * 使用查詢字符串:? ![](https://img.kancloud.cn/53/65/53651d69b4f0d1404c3f33e8a488571d_566x182.jpg) * 使用包含多值度量聚合的查詢: ![](https://img.kancloud.cn/3e/53/3e534ef2733b3a68551523ae31d13fd8_566x280.jpg) * 使用包含多桶聚合的查詢: ![](https://img.kancloud.cn/b5/dd/b5dd2c9205f42dc9dc92eca981f416c3_566x289.jpg) ### 計數 使用該`count`命令,您可以對某些索引和類型中可用的文檔進行計數。您還可以提供查詢。 ``` %elasticsearch count /index1,index2,.../type1,type2,... <JSON document containing the query OR a query string> ? ``` 例子: * 沒有查詢:? ![](https://img.kancloud.cn/f9/03/f903b72d796188d7e8900e35ae062c16_566x110.jpg) * 有一個查詢:? ![](https://img.kancloud.cn/aa/68/aa68c43916a64c8a0ecb72e6d0ca4761_566x116.jpg) ### 指數 使用該`index`命令,您可以在Elasticsearch中插入/更新文檔。 ``` %elasticsearch index /index/type/id <JSON document> %elasticsearch index /index/type <JSON document> ? ``` ### 刪除 使用該`delete`命令,您可以刪除文檔。 ``` %elasticsearch delete /index/type/id ? ``` ### 應用Zeppelin動態表單 您可以在查詢內使用[Zeppelin 動態表單](http://www.apache.wiki/pages/viewpage.action?pageId=10030585)。您可以同時使用`text input`和`select form`參數化功能。 ``` %elasticsearch size ${limit=10} search /index/type { "query": { "match_all": { } } }? ```
                  <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>

                              哎呀哎呀视频在线观看