Jun Zhang created OAK-9705:
------------------------------

             Summary: Explain Query tool doesn't show the correct ES query when 
suggest queries are made
                 Key: OAK-9705
                 URL: https://issues.apache.org/jira/browse/OAK-9705
             Project: Jackrabbit Oak
          Issue Type: Bug
            Reporter: Jun Zhang


When running the following suggest query from AEM(ES index is available)
{code}
SELECT [rep:suggest()] FROM [dam:Asset] as s WHERE SUGGEST('jav') option(index 
name [damAssetElastic-7-custom-2])
{code}
the detailed plan show that the following query is run on ES side:

{code}
{"bool":\{"must":[{"query_string":{"query":"suggest?term=jav","fields":[],"type":"best_fields","default_operator":"or","max_determinized_states":10000,"enable_position_increments":true,"fuzziness":"AUTO","fuzzy_prefix_length":0,"fuzzy_max_expansions":50,"phrase_slop":0,"escape":false,"auto_generate_synonyms_phrase_query":true,"fuzzy_transpositions":true,"boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}}
{code}


Instead, the following query is actually run on ES side:
{code}
POST cm-p11553-e21096-publish._damassetelastic-7-custom-2/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "nested": {
            "path": ":suggest",
            "query": {
              "match_phrase_prefix": {
                ":suggest.value": {
                  "query": "jav"
                }
              }
            }
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}
{code}

the Explain query should reflect the correct ES query as well.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to