match_phrase_prefix Java API ..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

match_phrase_prefix Java API ..

Anusha
Hi,

I would like to get the relevant JAVA API for the Query,

GET sayt/othermotive/_search
{
   "query": {
      "bool": {
         "must": [
            {
               "match": {
                  "yearCode": {
                     "query": "2012",
                     "type": "boolean"
                  }
               }
            }, {
        "match" : {
          "modelCode" : {
            "query" : "1",
            "type" : "boolean"
          }
        }
        }, {
        "match" : {
          "engineCode" : {
            "query" : "12",
            "type" : "boolean"
          }
        }
      }, {
        "term" : {
          "makeTypeCode" : "3"
        }
      },
            {
               "match_phrase_prefix": {
                  "partDescription":"a"
               }

            }
         ]
      }
   }
}

Am using a Java API as shown below:

builder.must(QueryBuilders.matchPhrasePrefixQuery("partDescription", term));

But this is building the query as

{
  "query" : {
    "bool" : {
      "must" : [ {
        "match" : {
          "yearCode" : {
            "query" : "2012",
            "type" : "boolean"
          }
        }
      }, {
        "match" : {
          "makeCode" : {
            "query" : "143",
            "type" : "boolean"
          }
        }
      }, {
        "match" : {
          "modelCode" : {
            "query" : "1",
            "type" : "boolean"
          }
        }
      }, {
        "match" : {
          "engineCode" : {
            "query" : "12",
            "type" : "boolean"
          }
        }
      }, {
        "term" : {
          "makeTypeCode" : "3"
        }
      }, {
        "match" : {
          "partDescription" : {
            "query" : "ac",
            "type" : "phrase_prefix"
          }

        }
      } ]
    }
  }
}


When I use this query am not getting result, When am using the query as I mention above with match_phrase_prefix it is giving the result

May I know the relevant Java API for match_phrase_prefix...

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
---
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1e008776-21db-4875-9b8a-ba58bfdf6f83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.