Elasticsearch Common Query

Source: Internet
Author: User

Tagged with: should last elastics RAS conditional query wildcard operator generated Quic

Query   DSLmatch queries  {"Match": {         "Tweet": "About Search"}} Note: Match queries can only search for an exact value of an exact field, and when searching for exact matches, you'd better use a filter statement because the filter statement can cache the data. match_phrase Query {    "Query": {        "Match_phrase": {            "title": "Quick brown fox"}}} Note: The query condition reference is not split compared to match: https://Blog.csdn.net/liuxiao723846/article/details/78365078?locationnum=2&fps=1 multi_match Query : For multiple field queries {"Multi_match": {         "Query": "Full Text Search",         "Fields": ["title", "Body"]}}bool query must: The query specifies that the document must be included. Filter: Similar to must but not scoring. Must_not: Query specified document must not be included. Should: queries the specified document and returns if one condition is met. POST _search{"Query": {    "BOOL" : {      "Must" : {        "term": {"user": "Kimchy" }      },      "Filter": {        "term": {"tag": "Tech" }      },      "Must_not" : {        "Range" : {          "Age": {"GTE": Ten, "LTE": 20 }        }      },      "Should" : [        { "term": {"tag": "Wow" } },        { "term": {"tag": "Elasticsearch" } }      ],      "Minimum_should_match": 1,      "Boost": 1.0}}}prefix query : What character begins with {"Query": {     "prefix": {       "hostname": "WX"}}}wildcards query : Wildcard query {"Query": {        "Wildcard": {            "Postcode": "W?" F*HW "}}} Note:? used to match any character, *used to match 0 or more characters regexp query : Regular expression Query {"Query": {        "RegExp": {            "Postcode": "w[0-9].+"}}} Note:1. field, entry field"Quick Brown Fox"will generate entries"Quick", "Brown" and "Fox" 2. Prefix,wildcard and RegExp query based on the term---------------------------------------------------------------------  Filter DSL Term filter  : Exact Match {"Query": {     "Term": {       "Age": 26}}}terms filter : Specify multiple match conditions {"Query": {     "Terms": {       "Status": [304, 302]}}}range filter {"Range": {         "Age": {             "GTE": 20,             "LT": 30}}} The scope operator contains: GT:: Greater than GTE:: Greater than or equal to LT:: Less than LTE:: Less than or equal to exists /missing Filtration: Filter field is present{     "Exists":   {         "Field": "title"}}bool Filter : Boolean logic to merge multiple filter criteria query Results {"BOOL": {         "must": {"term": {"folder": "Inbox" }},         "Must_not": {"term": {"tag": "Spam"  }},         "Should": [                     { "term": {"starred":true   }},                     { "term": {"unread":true}} ]}} Note: must:: Exact match for multiple query conditions, equivalent to and. Must_not:: The opposite match for multiple query conditions, equivalent to not. Should:: At least one of the query criteria matches, equivalent to or. 

Elasticsearch Common Query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.