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

[BUG] asserting error when profile is set to true and phrase queries are run on match_only_text_field #14156

Closed
rishabhmaurya opened this issue Jun 11, 2024 · 1 comment · Fixed by #14154 or #14286
Assignees
Labels
bug Something isn't working Search Search query, autocomplete ...etc v2.16.0 Issues and PRs related to version 2.16.0

Comments

@rishabhmaurya
Copy link
Contributor

Describe the bug

In query phase, when rewrite is called

the ContextIndexSearch will start the timer for the query and will start noting the rewrite() time for all clauses in the clauses for the complete query tree.

But if we try to use indexSearcher.rewrite(delegateQuery) within rewrite of any of the query, it will try to initialize the profiler and timer again and will result in the assertion error here -

»  java.lang.AssertionError
»       at org.opensearch.search.profile.query.AbstractQueryProfileTree.startRewriteTime(AbstractQueryProfileTree.java:48)
»       at org.opensearch.search.profile.query.QueryProfiler.startRewriteTime(QueryProfiler.java:80)
»       at org.opensearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:192)
»       at org.opensearch.index.query.SourceFieldMatchQuery.rewrite(SourceFieldMatchQuery.java:76)
»       at org.apache.lucene.search.IndexSearcher.rewrite(IndexSearcher.java:777)
»       at org.opensearch.search.internal.ContextIndexSearcher.rewrite(ContextIndexSearcher.java:196)
»       at org.opensearch.search.DefaultSearchContext.preProcess(DefaultSearchContext.java:362)
»       at org.opensearch.search.query.QueryPhase.preProcess(QueryPhase.java:127)
»       at org.opensearch.search.SearchService.createContext(SearchService.java:1053)

Related component

Search

To Reproduce

GET big5/_search
{
  "profile": true,
  "query": {
    "match_phrase": {
      "message": "weaver spirit"
    }
  }
}

run this query on an index with field message of type match_only_text.

Expected behavior

Expected profile output like below and not asserting error -

                "type": "SourceFieldMatchQuery",
                "description": """SourceFieldMatchQuery (delegate query: [ #message:weaver #message:spirit ], filter query: [ message:"weaver spirit"])""",
                "time_in_nanos": 274420046,
                "breakdown": {
                  "set_min_competitive_score_count": 0,
                  "match_count": 298,
                  "shallow_advance_count": 0,
                  "next_doc": 2777209,
                  "score_count": 19,
                  "compute_max_score_count": 0,
                  "advance": 0,
                  "advance_count": 0,
                  "score": 8959,
                  "shallow_advance": 0,
                  "create_weight_count": 1,
                  "build_scorer": 7353375,
                  "set_min_competitive_score": 0,
                  "match": 259317837,
                  "next_doc_count": 305,
                  "compute_max_score": 0,
                  "build_scorer_count": 14,
                  "create_weight": 4962666
                },
                "children": [
                  {
                    "type": "TermQuery",
                    "description": "message:weaver",
                    "time_in_nanos": 3292863,
                    "breakdown": {
                      "set_min_competitive_score_count": 0,
                      "match_count": 0,
                      "shallow_advance_count": 0,
                      "next_doc": 363713,
                      "score_count": 0,
                      "compute_max_score_count": 0,
                      "advance": 459067,
                      "advance_count": 3673,
                      "score": 0,
                      "shallow_advance": 0,
                      "create_weight_count": 1,
                      "build_scorer": 2468749,
                      "set_min_competitive_score": 0,
                      "match": 0,
                      "next_doc_count": 250,
                      "compute_max_score": 0,
                      "build_scorer_count": 21,
                      "create_weight": 1334
                    }
                  },
                  {
                    "type": "TermQuery",
                    "description": "message:spirit",
                    "time_in_nanos": 2067981,
                    "breakdown": {
                      "set_min_competitive_score_count": 0,
                      "match_count": 0,
                      "shallow_advance_count": 0,
                      "next_doc": 10045,
                      "score_count": 0,
                      "compute_max_score_count": 0,
                      "advance": 1298645,
                      "advance_count": 3762,
                      "score": 0,
                      "shallow_advance": 0,
                      "create_weight_count": 1,
                      "build_scorer": 758250,
                      "set_min_competitive_score": 0,
                      "match": 0,
                      "next_doc_count": 55,
                      "compute_max_score": 0,
                      "build_scorer_count": 21,
                      "create_weight": 1041
                    }
                  }
                ]
              }

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@rishabhmaurya rishabhmaurya added bug Something isn't working untriaged v2.15.0 Issues and PRs related to version 2.15.0 and removed untriaged labels Jun 11, 2024
@rishabhmaurya rishabhmaurya self-assigned this Jun 11, 2024
@rishabhmaurya
Copy link
Contributor Author

PR - #14154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Search Search query, autocomplete ...etc v2.16.0 Issues and PRs related to version 2.16.0
Projects
Status: Done
2 participants