Elasticsearch search api and DSL query

Why am I writing this shit, beacause the official documentation really really sucks, though you might find this article about es search api and query dsl sucks more.

Elasticsearch可以通過search api提供對文檔的精細檢索。Elasticsearch的search api對文檔的精細檢索主要靠Elasticsearch的DSL檢索語言實現(xiàn),它通過自身的query參數(shù)指定具體的DSL查詢語句。

    curl -XGET 'http://host:port/index/doc/_search' -d ' {   # request body
        ... 
        "query": {DSL_QUERY_CLAUSE}                          # query 參數(shù)
        ...
    }'
  • DSL語法
    DSL_QUERY_CLAUSE: 
    {
        QUERY_NAME: 
        {
            FIELD_NAME: 
            {
                ARGUMENT: VALUE,
                ARGUMENT: VALUE
               ...
            }
        }
    }
  • DSL 上下文

    • query context(按匹配程度篩選結(jié)果)
      • A query clause used in query context answers the question “How well does this document match this query clause?”
    • filter context(類似精確匹配)
      • In filter context, a query clause answers the question “Does this document match this query clause?”
  • Query clause 類型

    • leave clause
    • compound clause
      • wrap other leaf or compound queries and used to combine multiple queries in a logical fashion(quote from official documentation).
  • compound queries

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • ElasticSearch是一個高度可擴展的開源搜索引擎并使用REST API,所以您值得擁有。 在本教程中,將介...
    易百教程閱讀 1,974評論 0 15
  • Advantages of using elastic search Build on top of lucene...
    xianyu閱讀 518評論 0 2
  • 最近,頻頻從朋友,以及地鐵里、電梯里的陌生人口里聽到“許仙”這兩個字。 一般是這樣:“你家那邊沒有許仙嗎?” 愛觀...
    郭小果子閱讀 668評論 0 0
  • 哈哈哈哈哈哈……
    屠心陌路閱讀 189評論 0 0
  • 朋友以前不止一次埋怨:給你介紹這個不滿意,那個面都不見,你到底想怎樣啊?那誰誰,你當(dāng)初不待見的,人家現(xiàn)在好幾套房子...
    蘇夏閱讀 1,180評論 3 15

友情鏈接更多精彩內(nèi)容