Query DSL: how to use phrase_prefix in query string?

Hi, I want to search thorough hole my documents, and for a specific query I want it returns results with suffix and prefix.. right now when my query run.. it returns just documents that have exact value, that have been searched, for my search structure I have three way:

  1. I want documents that have the exact value (right now it works as I expected)
  2. I want documents that have part of that query.. (for example: if I search engineer... the search result returns engineering too. (right now it doesn't)).
  3. my query may have one or more word.. so I want my search results returns documents that have one or more query in them..

this is part of my query:

[
   "query" => [
      "bool" => [
        "must" => [
          [
           "query_string" => [
               "query" => "engineer"
               "boost" => 1
             ]
           ]
           [
            "query_string" => [
                "query" => ""engineer*""
                "default_operator" => "AND"
              ]
            ]
            [
               "query_string" => [
                  "query" => "engineer"
                  "default_operator" => "OR"
               ]
            ]
        ]
        "must_not" => []
        "filter" => []
     ]
   ]
]

after I searched more.. I found this:

[
    "query" => [
      "bool" => [
        "must" => [
          [
            "query_string" => [
              "query" => "engineering chemic*"
              "analyze_wildcard" => true
              "default_operator" => "OR"
            ]
          ]
          [
            "multi_match" => [
              "query" => "engineering chemic"
              "type" => "phrase_prefix"
              "fields" => [
                "educations.education_title"
              ]
            ]
          ]
        ]
        "must_not" => []
        "filter" => []
      ]
    ]
  ]

here if I want one_or_more search: it just return documents that have both strings.. just return 1 result..
and if my query was :"engineering" it returns 4 results... the point is I want it returns me 5 results if I search for "engineering chemic" but returns 1.. the document that have both of them!

and also I don't know how "phrase_prefix" on hole my document.. currently I used that for certain fields.. but I want that for hole document.

can anyone help me to how get my result with different conditions that I explained above?
thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.