# Fetching PhaseFreq of a Span Near query

**URL:** <https://discuss.elastic.co/t/fetching-phasefreq-of-a-span-near-query/26946>\
**Category:** Elasticsearch\
**Created:** [August 6, 2015, 6:42am UTC](https://discuss.elastic.co/t/fetching-phasefreq-of-a-span-near-query/26946 "2015-08-06T06:42:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sruthi\_Nagalla](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Sruthi\_Nagalla](https://discuss.elastic.co/u/Sruthi_Nagalla)\
**Post date:** [August 6, 2015, 6:42am UTC](https://discuss.elastic.co/t/fetching-phasefreq-of-a-span-near-query/26946/1 "2015-08-06T06:42:50Z")

</div>

Hi,  
I have a span near query which returns certain result. Now I want to extract the tf/phasefreq. I don't want to parse. I am looking at writing a dynamic script (Groovy) to fetch it. So far I am not successful.  
Below is how the result looks like in explanation field and I want to fetch phraseFreq=0.33333334:  
"\_explanation": {  
"value": 0.03321779,  
"description": "weight(spanNear([text:really, text:nice], 0, true) in 0) [PerFieldSimilarity], result of:",  
"details": [  
{  
"value": 0.03321779,  
"description": "fieldWeight in 0, product of:",  
"details": [  
{  
"value": 0.57735026,  
"description": "tf(freq=0.33333334), with freq of:",  
"details": [  
{  
"value": 0.33333334,  
"description": "phraseFreq=0.33333334"  
}  
]  
},

---

<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 5, 2017, 11:57pm UTC](https://discuss.elastic.co/t/fetching-phasefreq-of-a-span-near-query/26946/2 "2017-07-05T23:57:11Z")

</div>


