💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# Assertions() 原文链接 : [https://www.elastic.co/guide/en/elasticsearch/reference/5.3/getting-started.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.3/getting-started.html)(修改该链接为官网对应的链接) 译文链接 : [http://www.apache.wiki/display/Elasticsearch](http://www.apache.wiki/display/Elasticsearch)(修改该链接为 **ApacheCN** 对应的译文链接) 贡献者 : @您的名字,[ApacheCN](/display/~apachecn),[Apache中文网](/display/~apachechina) ## 目录 1 - 标题 2 As many elasticsearch tests are checking for a similar output, like the amount of hits or the first hit or special highlighting, a couple of predefined assertions have been created. Those have been put into the `ElasticsearchAssertions` class. There is also a specific geo assertions in `ElasticsearchGeoAssertions`. | `assertHitCount()` | Checks hit count of a search or count request | | `assertAcked()` | Ensure the a request has been acknowledged by the master | | `assertSearchHits()` | Asserts a search response contains specific ids | | `assertMatchCount()` | Asserts a matching count from a percolation response | | `assertFirstHit()` | Asserts the first hit hits the specified matcher | | `assertSecondHit()` | Asserts the second hit hits the specified matcher | | `assertThirdHit()` | Asserts the third hits hits the specified matcher | | `assertSearchHit()` | Assert a certain element in a search response hits the specified matcher | | `assertNoFailures()` | Asserts that no shard failures have occurred in the response | | `assertFailures()` | Asserts that shard failures have happened during a search request | | `assertHighlight()` | Assert specific highlights matched | | `assertSuggestion()` | Assert for specific suggestions | | `assertSuggestionSize()` | Assert for specific suggestion count | | `assertThrows()` | Assert a specific exception has been thrown | Common matchers | `hasId()` | Matcher to check for a search hit id | | `hasType()` | Matcher to check for a search hit type | | `hasIndex()` | Matcher to check for a search hit index | | `hasScore()` | Matcher to check for a certain score of a hit | | `hasStatus()` | Matcher to check for a certain `RestStatus` of a response | Usually, you would combine assertions and matchers in your test like this ## 目录 2 - 标题 2 正文2 ## 目录 3 - 标题 2 正文3 ## 目录 N - 标题 2 正文4