# GeoBoudingBox Multiple Query DSL

**URL:** <https://discuss.elastic.co/t/geoboudingbox-multiple-query-dsl/121820>\
**Category:** Elasticsearch\
**Created:** [February 28, 2018, 10:02am UTC](https://discuss.elastic.co/t/geoboudingbox-multiple-query-dsl/121820 "2018-02-28T10:02:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiSiZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/disiz/32/60095_2.png) [@DiSiZ](https://discuss.elastic.co/u/DiSiZ)\
**Post date:** [February 28, 2018, 10:02am UTC](https://discuss.elastic.co/t/geoboudingbox-multiple-query-dsl/121820/1 "2018-02-28T10:02:39Z")

</div>

Hello,

I've got two points and i'd like in my request to define a boudingbox, and if one of those two points are in my rectangle.

Actually it work only with 1 points i've made few research to do multiple field request, like in the ES NEST documentation but it doesn't work for me.

Heres my request :

```
var searchResponse = client.LowLevel.Search<StringResponse>("jam", "jam", PostData.Serializable(new SearchDescriptor<Source>()
   .From(0)
   .Size(size)
    .Query(q => q
        .Bool(b => b                
            .Must(fi => fi
                .DateRange(r => r
                    .Field(f => f.Timestamp)
                    .GreaterThanOrEquals(limitDate)
                    .LessThan(DateTime.Now)
                ), mu => mu
            )
            .Filter(mu => mu
                 .GeoBoundingBox(ge => ge
                     .Field(f => f.Start)
                     .Field(f => f.End)
                     .BoundingBox(latLeft, lonLeft, latRight, lonRight)  
                 )
             )                           
         )
     )
 ));

```

The two points are **f.Start** & **f.End** , so in this exemple it will just return if the point .End correspond to the box.

To simplify id like a request that do :

```
( Time && (PointA || PointB) )

```

Atm it does :

```
( Time && PointA ) OR ( Time && PointB )

```

Thanks for your help, I hope its clear

---

<div class="post-metadata">

**Author:** ![DiSiZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/disiz/32/60095_2.png) [@DiSiZ](https://discuss.elastic.co/u/DiSiZ)\
**Post date:** [February 28, 2018, 10:32am UTC](https://discuss.elastic.co/t/geoboudingbox-multiple-query-dsl/121820/2 "2018-02-28T10:32:50Z")

</div>

Found it the answer is :

```
                        .Filter(mu => mu
                            .GeoBoundingBox(ge => ge
                                .Field(f => f.End)
                                .BoundingBox(latLeft, lonLeft, latRight, lonRight) 
                            ) || q
                            .GeoBoundingBox(ge => ge
                                .Field(f => f.Start)
                                .BoundingBox(latLeft, lonLeft, latRight, lonRight)
                            )
```

---

<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 28, 2018, 10:33am UTC](https://discuss.elastic.co/t/geoboudingbox-multiple-query-dsl/121820/3 "2018-03-28T10:33:30Z")

</div>

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