Hey everybody,

I am looking for Lucene not ElasticSeach syntax to format phrase prefix 
query to find people.

Sample request:
post /person/_search
{
  "query" : {
    "query_string": {
      "query": "Title:Jake AND Title:J*"
    }
  },
  "_source":[
      "Title"
      ]
}

Sample Response:
{
   "took": 0,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 2,
      "max_score": 5.546068,
      "hits": [
         {
            "_index": "18c252a5-82d3-45f0-9fa3-4bf799194037",
            "_type": "person",
            "_id": "d04e1479-0a85-4c24-be80-5cff8f8d8a7c",
            "_score": 5.546068,
            "_source": {
               "Title": "Jake Johnson"
            }
         },
         {
            "_index": "18c252a5-82d3-45f0-9fa3-4bf799194037",
            "_type": "person",
            "_id": "51deb8bb-b1d7-471e-9cbb-ab9e853976a7",
            "_score": 5.546068,
            "_source": {
               "Title": "Jake Lacy"
            }
         }
      ]
   }
}

Problem: 'Jake Lacy' from human perspective should not have been in the 
results.

I appreciate there is a ElasticSearch specific solution to the problem with 
following problem:
post person/_search
{
  "query" : {
    "match_phrase_prefix": {
            "Title": "Jake J"
          }
  },
  "_source":[
      "Title"
      ]
}


With desired results:
{
   "took": 0,
   "timed_out": false,
   "_shards": {
      "total": 1,
      "successful": 1,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 279.47867,
      "hits": [
         {
            "_index": "18c252a5-82d3-45f0-9fa3-4bf799194037",
            "_type": "person",
            "_id": "d04e1479-0a85-4c24-be80-5cff8f8d8a7c",
            "_score": 279.47867,
            "_source": {
               "Title": "Jake Johnson"
            }
         }
      ]
   }
}

I am however stubbornly insistent n finding out whether there is a Lucene 
syntax solution to that challenge. 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f5997311-ae6c-4404-bc46-05995d972afa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to