Elasticsearch의 URL 및 Request Body 질의 문구

2841 단어 elasticsearch
URL 질의
 :

GET /movies/_search?q=2012&df=title&sort=year:desc&from=0&size=10&timeout=1s
{
    "profile":"true"
}

구문 설명:
  • q 쿼리 문장을 지정하고 Query String Syntax를 실험합니다
  • df 기본 필드, 지정하지 않을 때 모든 필드를 조회합니다
  • 정렬/from 및 크기는 페이지를 나누는 데 사용됩니다
  • 프로필은 조회가 어떻게 실행되는지 볼 수 있습니다

  •  
    질의 예
    GET /movies/_search?q=2012&df=title&sort=year:desc&from=0&size=10&timeout=1s
    {
      "profile": "true"
    }
    
    GET /_cat/indices
    
    GET /movies/_search?q=title:"Beautiful Mind"
    {
      "profile": "true"
    }
    
    
    GET /movies/_search?q=title:Beautiful Mind 
    {
      "profile": "true"
    }
    GET /movies/_search?q=title:(Beautiful Mind) 
    {
      "profile": "true"
    }
    GET /movies/_search?q=title:(Beautiful AND Mind) 
    {
      "profile": "true"
    }
    GET /movies/_search?q=title:(Beautiful %2BMind) 
    {
      "profile": "true"
    }
    //     [] {}  
    GET /movies/_search?q=year:{1980 TO 2000]
    {
      "profile": "true"
    }
    //  
    GET /movies/_search?q=year:>1980
    {
      "profile": "true"
    }
    //  ( , , , )
    GET /movies/_search?q=title:b*
    {
      "profile": "true"
    }
    //  
    GET /movies/_search?q=title:[bt]oy
    {
      "profile": "true"
    }
    //    
    GET /movies/_search?q=title:beautifl~1
    {
      "profile": "true"
    }
    //    
    GET /movies/_search?q=title:"Lord Rings"~2
    {
      "profile": "true"
    }

    Request Body Search
    // Request Body Search
    
    //  
    GET /kibana_sample_data_ecommerce/_search
    {
      "sort":[{"order_date":"desc"}],
      "query": {
        "match_all": {}
      }
    }
    //  source  
    GET /kibana_sample_data_ecommerce/_search
    {
      "_source":["order_date"],
      "query": {
        "match_all": {}
      }
    }
    //   
    GET /kibana_sample_data_ecommerce/_search
    {
      "script_fields": {
        "new_field": {
          "script": {
            "lang": "painless",
            "source": "doc['order_date'].value+'_hello'"
          }
        }
      },
      "query": {
        "match_all": {}
      }
    }
    //   Match Phrase
    // or  
    POST movies/_search
    {
      "query": {
        "match": {
          "title": "Last Christmas"
        }
      }
    }
    //  Last Christms title
    POST movies/_search
    {
      "query": {
        "match": {
          "title": {
            "query": "Last Christmas",
            "operator": "and"
          }
        }
      }
    }
    // slop    
    POST movies/_search
    {
      "query": {
        "match_phrase": {
          "title": {
            "query": "one love",
            "slop": 1
          }
        }
      }
    }

    좋은 웹페이지 즐겨찾기