Elasticsearch Query Statement

Source: Internet
Author: User

Rich query Statements:

#match查询 This will separate the two characters of the reptile from the case of Word get
lagou/_search
{
	"query": {"
		match": {"
			title": "Reptile"
		}
	}
}

#term查询 Reptilian Word does not handle unresolved fields get
lagou/_search
{
	"query": {"
		term": {"
			title": "Crawler"
		}
	}
}

#terms查询 as long as a field in the list and return results get
lagou/_search
{
	"query": {"
		terms": {"
			title": ["crawler", "website"]
		}
	}
}

#控制查询的返回结果 quantity control Get
lagou/_search
{
	"query": {"
		match": {"
			title": "Reptile"
		}
	},
	"Form": 1,
	"size": 2
}

#match_phrase短语查询 the keyword participle, but the query results must meet all the entries
#slop表示词条之间的最小距离 
Get lagou/_search
{"Query": {"match_phrase": {"title": {"
				query": "Python system",
				" Slop ": 6}}}}

#multi_search Specify multiple field queries
#fields indicate the target field of the query get
lagou/_search {"Query": {"Multi_match": {"title": {"
				query": "Python system",
				"Fields": [title], " Desc "]}}}}

#指定返回字段" title "," Company_Name "Get
lagou/_search
{
	" Stored_fields ": [" title "," Company_Name "],
	" query ": {
		" match ": {"
			title ":" Python "
		}
	}
	}


#sort结果排序
#range范围查询
#wildCard模糊查询

And also:

#bool查询Bool查询对应Lucene中的BooleanQuery, it consists of one or more clauses, each of which has a specific type.


Must
The returned document must satisfy the conditions of the MUST clause and participate in the calculated score


Filter
The returned document must satisfy the condition of the filter clause. But not as must, to participate in the calculation of the score


Should
The returned document may satisfy the conditions of the should clause. In a bool query, if there is no must or filter, there is one or more should clauses, so you can return if you satisfy one. The Minimum_should_match parameter defines at least several clauses.


Must_nout
The returned document must not meet the criteria defined by Must_not.


If a query has both a filter and a should, then at least one should clause is included.


The bool query also supports disabling the collaborative scoring option Disable_coord. The general calculation of the score depends on all the query conditions.


BOOL query is also the mechanism of using more_matches_is_better, so the documents satisfying must and should clauses will be combined to calculate the score.




Related Article

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.