# Lucene syntax for phrase prefix?

**URL:** https://discuss.elastic.co/t/lucene-syntax-for-phrase-prefix/17537
**Category:** Elasticsearch
**Created:** [May 15, 2014, 3:09pm UTC](https://discuss.elastic.co/t/lucene-syntax-for-phrase-prefix/17537 "2014-05-15T15:09:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Vladimir\_Khazin](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@Vladimir\_Khazin](https://discuss.elastic.co/u/Vladimir_Khazin)
#### Post date: [May 15, 2014, 3:09pm UTC](https://discuss.elastic.co/t/lucene-syntax-for-phrase-prefix/17537/1 "2014-05-15T15:09:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:29am UTC](https://discuss.elastic.co/t/lucene-syntax-for-phrase-prefix/17537/2 "2017-07-06T01:29:08Z")

</div>


