1. Assertions()

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/5.3/getting-started.html(修改该链接为官网对应的链接)

译文链接 : http://www.apache.wiki/display/Elasticsearch(修改该链接为 ApacheCN 对应的译文链接)

贡献者 : @您的名字,ApacheCNApache中文网

1.1. 目录 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

1.2. 目录 2 - 标题 2

正文2

1.3. 目录 3 - 标题 2

正文3

1.4. 目录 N - 标题 2

正文4

Copyright © Kilvn 2021. all right reserved,powered by Gitbook最后更新时间: 2021-06-08 20:22:42

results matching ""

    No results matching ""