Documents containing quick brown fox-> score: 4.5*3/3 = 4.5In the above results, the score of the document containing all three entries is much higher than that of the document containing only two entries.
Remember that the query for quick brown fox will be overwritten by the bool query as follows:
GET /_search{ query: { bool: { should: [ { term: { text: quick }}, { term: { text: brown }}, { term: { text: fox }} ] } }}
By default, bool queries enable Coordination for all query clauses, but you can disable it. Why do you need to disable it? Well, the general answer is: no. Query Coordination usually plays a positive role. When you use bool queries to wrap multiple advanced queries such as match, enabling Coordination also makes sense. The more matched query clauses, the higher the degree of matching between the documents returned by your search results.
However, in some advanced cases, disabling Coordination also makes sense. For example, you are querying synonyms such as jump, leap, and hop. You don't need to care how many times these synonyms appear, because they express the same concept. In fact, only one of them may appear. In this case, disabling the Coordination factor is a good choice:
GET /_search{ query: { bool: { disable_coord: true, should: [ { term: { text: jump }}, { term: { text: hop }}, { term: { text: leap }} ] } }}
When you use Synonyms (See Synonyms), this occurs internally: The rewritten query disables Coordination for Synonyms. Most cases that disable Coordination will be automatically processed; you don't have to worry about it.
Index-time Field-level Boosting)Here we will discuss how to promote a field-make this field more important than other fields-by using Query-time Boosting during Query ). It is also possible to improve a field during the index. In fact, this elevation applies to each entry of a field, rather than the field itself.
In order to store the upgraded value to the index with as little space as possible, the increase in the field level during the index will be reduced together with the field length to be saved in the index in one byte. It is the value returned by norm (t, d) in the previous formula.
Warning
We strongly recommend that you do not use field-level indexes for the following reasons:
After explaining the query reduction, Coordination, and index improvement, we can now start to discuss the most useful tool for influencing relevance computing: Improving during the query.
Query-time Boosting)
In the Prioritizing of query clause, we have introduced how to use the boost parameter to add weights to a query clause during search. For example:
GET /_search{ query: { bool: { should: [ { match: { title: { query: quick brown fox, boost: 2 } } }, { match: { content: quick brown fox } } ] } }}
Promotion During query is the main tool used to optimize relevance. All types of queries accept the boost parameter. Setting boost to 2 does not simply double the final _ score. The exact increase value is normalized and obtained through some internal optimization. However, it also means that a sub-statement with an increase of 2 is twice more important than a sub-statement with an increase of 1.
In fact, there is no formula to determine the correct increment value for a specific query clause. It is obtained by trying. Remember that boost is only one factor in the correlation score; it needs to compete with other factors. For example, in the above example, the title Field has a natural improvement relative to the content Field. This improvement comes from the Field length reduction (Field-length Norm) (because the title is usually shorter than the relevant content), do not blindly promote a field because you think it should be promoted. Apply an elevation value, check the result, and then modify it.
Boosting an Index)When searching for Multiple indexes, you can use the indices_boost parameter to improve the entire index. In the following example, we will give more weight to the documents in the recent index:
GET /docs_2014_*/_search { indices_boost: { docs_2014_10: 3, docs_2014_09: 2 }, query: { match: { text: quick brown fox } }}
This Multi-index Search queries all indexes starting with docs_2014. The document upgrade value in index docs_2014_10 is 3, the document upgrade value in index docs_2014_09 is 2, and the document upgrade value in other indexes is 1 by default.
T. getBoost ()These elevation values are expressed by the t. getBoost () element in Lucene's Practical Scoring Function. The upgrade is not applicable where the query DSL appears. On the contrary, any promoted value is merged and then transmitted to each entry. The value returned by the t. getBoost () method is applicable to the increase value on the entry itself, or the increase value applied to upper-level queries.
TIP
In fact, reading and interpreting the API output itself is more complex than the preceding descriptions. You cannot see the boost value or t. getBoost () in your explanation (). Promoted to queryNorm applicable to specific terms. Although we have said that queryNorm is the same for any entry, queryNorm will be higher for the upgraded entry.