<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 搜索文檔 要從Elasticsearch中獲取文檔,我們需要使用同樣的`_index`,`_type`以及 `_id`但是不同的HTTP變量`GET`: ~~~ GET /website/blog/123?pretty ~~~ 返回結果包含了之前提到的內容,以及一個新的字段`_source`,它包含我們在最初創建索引時的原始JSON文檔。 ~~~ { "_index" : "website", "_type" : "blog", "_id" : "123", "_version" : 1, "found" : true, "_source" : { "title": "My first blog entry", "text": "Just trying this out..." "date": "2014/01/01" } } ~~~ > #### `pretty` 在任意的查詢字符串中添加`pretty`參數,類似上面的請求,Elasticsearch就可以得到_優美打印_的更加易于識別的JSON結果。`_source`字段不會執行優美打印,它的樣子取決于我們錄入的樣子。 GET請求的返回結果中包含`{"found": true}`。這意味著這篇文檔確實被找到了。如果我們請求了一個不存在的文檔,我們依然會得到JSON反饋,只是`found`的值會變為`false`。 同樣,HTTP返回碼也會由`'200 OK'`變為`'404 Not Found'`。我們可以在`curl`后添加`-i`,這樣你就能得到反饋頭文件: ~~~ curl -i -XGET /website/blog/124?pretty ~~~ 反饋結果就會是這個樣子: ~~~ HTTP/1.1 404 Not Found Content-Type: application/json; charset=UTF-8 Content-Length: 83 { "_index" : "website", "_type" : "blog", "_id" : "124", "found" : false } ~~~ ### 檢索文檔中的一部分 通常,`GET`請求會將整個文檔放入`_source`字段中一并返回。但是可能你只需要`title`字段。你可以使用`_source`得到指定字段。如果需要多個字段你可以使用逗號分隔: ~~~ GET /website/blog/123?_source=title,text ~~~ 現在`_source`字段中就只會顯示你指定的字段: ~~~ { "_index" : "website", "_type" : "blog", "_id" : "123", "_version" : 1, "exists" : true, "_source" : { "title": "My first blog entry" , "text": "Just trying this out..." } } ~~~ 或者你只想得到`_source`字段而不要其他的元數據,你可以這樣請求: ~~~ GET /website/blog/123/_source ~~~ 這樣結果就只返回: ~~~ { "title": "My first blog entry", "text": "Just trying this out...", "date": "2014/01/01" } ~~~
                  <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>

                              哎呀哎呀视频在线观看