# Lucene query on nested type

**URL:** <https://discuss.elastic.co/t/lucene-query-on-nested-type/248434>\
**Category:** Elasticsearch\
**Created:** [September 13, 2020, 7:45am UTC](https://discuss.elastic.co/t/lucene-query-on-nested-type/248434 "2020-09-13T07:45:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yuval99](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuval99/32/44696_2.png) [@Yuval99](https://discuss.elastic.co/u/Yuval99)\
**Post date:** [September 13, 2020, 7:45am UTC](https://discuss.elastic.co/t/lucene-query-on-nested-type/248434/1 "2020-09-13T07:45:35Z")

</div>

Hi guys!  
We are trying to make a search based on lucene syntax on object with nested type fields.  
We looked on DSL but it's not fitted to our requirements.  
Our data looks like:  
{ scans: [{ ip: "1.2.3.4", is\_malware: true }, { ip: "1.2.3.5", is\_malware: false }] }

Any solutions or workarounds are welcome!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 13, 2020, 10:43am UTC](https://discuss.elastic.co/t/lucene-query-on-nested-type/248434/2 "2020-09-13T10:43:48Z")

</div>

If you are using nested mappings you need to used nested DSL queries. Query string searches (if this is what you are referring to) can as far as I know not handle nested mappings. If you need to avoid DSL you probably need to flatted your data model to avoid nested mappings.

---

<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:** [October 11, 2020, 10:43am UTC](https://discuss.elastic.co/t/lucene-query-on-nested-type/248434/3 "2020-10-11T10:43:48Z")

</div>

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