# spanNear queries Vs phrase match query in elasticsearch

**URL:** <https://discuss.elastic.co/t/spannear-queries-vs-phrase-match-query-in-elasticsearch/164990>\
**Category:** Elasticsearch\
**Created:** [January 21, 2019, 7:31am UTC](https://discuss.elastic.co/t/spannear-queries-vs-phrase-match-query-in-elasticsearch/164990 "2019-01-21T07:31:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [January 21, 2019, 7:31am UTC](https://discuss.elastic.co/t/spannear-queries-vs-phrase-match-query-in-elasticsearch/164990/1 "2019-01-21T07:31:44Z")

</div>

Hello,

I was trying to use the phrase boost for the matching documents , the same way we do in solr ( we can specify pf , pf2 ,pf3 ) . Can we specify the same in elasticsearch ?

I came across phrase query that can be used within bool query , then I saw span near query . Could you please let me know when to use match phrase query and when to use spanNear ?

Also , how to specify the slop , let say in solr we can say pf3 means , 3 consecutive words can match , if it does it will boost higher . How to do the same in elastic.

Thanks,  
Navneet

---

<div class="post-metadata">

**Author:** ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)\
**Post date:** [February 5, 2019, 6:42am UTC](https://discuss.elastic.co/t/spannear-queries-vs-phrase-match-query-in-elasticsearch/164990/2 "2019-02-05T06:42:47Z")

</div>

@elastic - Could anyone please clarify this ?

Thanks,  
Navneet

---

<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:** [March 5, 2019, 6:42am UTC](https://discuss.elastic.co/t/spannear-queries-vs-phrase-match-query-in-elasticsearch/164990/3 "2019-03-05T06:42:54Z")

</div>

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