Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Rewrite 'rewrite' parameter docs #42018

Merged
merged 2 commits into from
May 13, 2019
Merged

[DOCS] Rewrite 'rewrite' parameter docs #42018

merged 2 commits into from
May 13, 2019

Conversation

jrodewig
Copy link
Contributor

@jrodewig jrodewig commented May 9, 2019

Changes

  • Retitles page and removes references to multi term query. If users understand which queries are rewritten, I'm not sure if an understanding of the 'multi term query' concept is needed.
  • Adds a warning noting the parameter is for expert users.
  • Adds details about how impacted queries are rewritten.
  • Rewrites value definitions
  • Adds section for performance considerations.

This is part of #40977, an effort to standardize documentation for query types.

Any and all feedback welcome!

Before

Before image rewrite-before

After

After image rewrite-before

@jrodewig jrodewig added >docs General docs changes :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.2.0 v7.0.2 v7.1.0 v7.3.0 labels May 9, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

WARNING: This parameter is for expert users only. Changing the value of this
parameter can impact search performance and relevance.

To improve performance, {es} rewrites the following queries:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if rewrite happens to improve performance. I think it happens just to break up complex queries into term based queries that Lucene can execute


* <<query-dsl-prefix-query, `prefix`>>
* <<query-dsl-query-string-query, `query_string`>>
* <<query-dsl-wildcard-query, `wildcard`>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other queries as well that get rewritten. For example, regexp, fuzzy, prefix can also be rewritten.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mayya-sharipova. I added these queries with 50505e6.

In their original form, these queries are expensive. {es} changes the
original query to a less expensive <<query-dsl-bool-query, `bool` query>>. This
`bool` query contains a `should` clause and <<query-dsl-term-query, `term`
query>> for each matching term.
Copy link
Contributor

@mayya-sharipova mayya-sharipova May 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this is always the case, but may be @jimczi can confirm here. As I understood it, sometimes for constant_score instead of a boolean query, we just use a document bit set. And the rewrite is done by Lucene, not ES

=== Valid values

`constant_score` (Default)::
Automatically uses the `constant_score_boolean` or `scoring_boolean` method,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think constant_score uses scoring_boolean

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jrodewig. Very nice work, we just to need to clarify several items.

@jrodewig
Copy link
Contributor Author

jrodewig commented May 10, 2019

Thanks so much for your thorough feedback, @mayya-sharipova! I made several changes you suggested with 50505e6:

  • Adds information about Lucene. Corrected several 'Elasticsearch' mentions to 'Lucene.'
  • Adds fuzzy and regexp to the list of queries
  • Adds information about constant_score using a bit set.
  • Moves information about rewriting as bool queries to the appropriate definitions

Please let me know if you see any other needed changes.

`constant_score` (Default)::
Uses the `constant_score_boolean` method for fewer matching terms. Otherwise,
this method finds all matching terms in sequence and returns matching documents
using a bit set.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayya-sharipova @jimczi

Please confirm that this constant_score definition is accurate.

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jrodewig. The final version looks good to me!

@jrodewig jrodewig merged commit 45e1e59 into elastic:master May 13, 2019
@jrodewig jrodewig deleted the multi-term-query-rewrite branch May 13, 2019 12:42
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search/Search Search-related issues that do not fall into other categories v7.0.2 v7.1.0 v7.2.0 v7.3.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants