Is this possible to have multiple BoudingBox for one geoboundingbox ?
Let me add some details, right now i have this kind of request:
BOOL
|_____MUST
--------|______TERM1
--------|
--------|FILTER
--------|_______TERM1
--------|_______TERM2
--------|_______TERM3
--------|_______TERM4
I'd like to have this scheme :
BOOL
|_____MUST
--------|______TERM1
--------|
--------|AND
--------|
--------|FILTER
--------|_______TERM1
--------|_______TERM2
--------|_______TERM3
--------|_______TERM4
--------|
--------| OR
--------|
--------|FILTERx
--------|_______TERM1x
--------|_______TERM2x
--------|_______TERM3x
--------|_______TERM4x
1 filter is equivalent to 1 boudingbox request.
The problem is, he always take the last filter written as condition.
Using Query DSL here's my code 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.End)
.BoundingBox(latLeft2, lonLeft2, latRight2, lonRight2)
) || q
.GeoBoundingBox(ge => ge
.Field(f => f.Start)
.BoundingBox(latLeft2, lonLeft2, latRight2, lonRight2)
)
)
.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)
)
)
)
)
));
In this case he always choose the seconde filter, which is logic, im trying some tricks to change that, as a beginner on Elastic.NET its pretty hard
Found it :
.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)
) || q
.GeoBoundingBox(ge => ge
.Field(f => f.End)
.BoundingBox(latLeft2, lonLeft2, latRight2, lonRight2)
) || q
.GeoBoundingBox(ge => ge
.Field(f => f.Start)
.BoundingBox(latLeft2, lonLeft2, latRight2, lonRight2)
)
)
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.