# Proxmity search (group based)

**URL:** https://discuss.elastic.co/t/proxmity-search-group-based/23646
**Category:** Elasticsearch
**Created:** [May 19, 2015, 10:26am UTC](https://discuss.elastic.co/t/proxmity-search-group-based/23646 "2015-05-19T10:26:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![balaa\_gs](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@balaa\_gs](https://discuss.elastic.co/u/balaa_gs)
#### Post date: [May 19, 2015, 10:26am UTC](https://discuss.elastic.co/t/proxmity-search-group-based/23646/1 "2015-05-19T10:26:38Z")

</div>

Hi

```
 i am having the same doubt which you have asked.

 is there any possibility to work like below query

 ((A OR B) AND (C OR D)~5)

```

Ex:  
my expected result = (A OR B) within 5 words of (C OR D)

```
   if A is the result of first group, C is the result of 2nd group, then A should be with in 5 words of C.
```

---

<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, 12:13am UTC](https://discuss.elastic.co/t/proxmity-search-group-based/23646/2 "2017-07-06T00:13:20Z")

</div>


