# Lookup and complex query

**URL:** <https://discuss.elastic.co/t/lookup-and-complex-query/36963>\
**Category:** Elasticsearch\
**Created:** [December 11, 2015, 9:36am UTC](https://discuss.elastic.co/t/lookup-and-complex-query/36963 "2015-12-11T09:36:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adellarocca](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@adellarocca](https://discuss.elastic.co/u/adellarocca)\
**Post date:** [December 11, 2015, 9:36am UTC](https://discuss.elastic.co/t/lookup-and-complex-query/36963/1 "2015-12-11T09:36:55Z")

</div>

Hi!  
I've understood that join and lookup are very complex problems in NoSQL technologies.  
Neverthless,I need of help.  
I have a list of events that are indexed in elasticsearch. For example:

id\_product = "152t36"  
id\_profile ="1"  
current\_pressure=121.00  
current\_temperature=23

Each id\_profile defines a correct operation profile with range values. For example

Id\_profile="1"  
min\_pressure=100  
max\_pressure=150  
min\_temperature=10  
max\_temperature=30

Id\_profile="2"  
min\_pressure=104  
max\_pressure=123  
min\_temperature=11  
max\_temperature=34

I need of a query that signal all devices that have values out of range.

What's the best strategy?  
If I index also correct operation profile, how can I join profiles and make the necessary controls?

Thank you very much!

---

<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:31pm UTC](https://discuss.elastic.co/t/lookup-and-complex-query/36963/2 "2017-07-05T23:31:52Z")

</div>

Closed on July 5, 2017, 11:31pm UTC


