# Using more like this query with documents containing nested objects

**URL:** <https://discuss.elastic.co/t/using-more-like-this-query-with-documents-containing-nested-objects/97259>\
**Category:** Elasticsearch\
**Created:** [August 16, 2017, 1:06pm UTC](https://discuss.elastic.co/t/using-more-like-this-query-with-documents-containing-nested-objects/97259 "2017-08-16T13:06:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![saravanan\_n](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@saravanan\_n](https://discuss.elastic.co/u/saravanan_n)\
**Post date:** [August 16, 2017, 1:06pm UTC](https://discuss.elastic.co/t/using-more-like-this-query-with-documents-containing-nested-objects/97259/1 "2017-08-16T13:06:27Z")

</div>

We have two types A and B. In type A there are some nested properties, which has some text similar to the text in documents of type B.

When we do the following query, the returned results are empty, even though there are matching documents in type B.

1. POST test/B/\_search  
{  
"query": {  
"more\_like\_this": {  
"like": [{  
"\_index": "test",  
"\_type": "A",  
"\_id": "4",  
}],  
"min\_term\_freq": 1,  
"min\_doc\_freq": 1  
}  
}  
}

But if we just copy and paste the from the properties of nested objects in the query as below, it works as expected.  
2. POST test/B/\_search  
{  
"query": {  
"more\_like\_this": {  
"like": ["some text from nested object fields"],  
"min\_term\_freq": 1,  
"min\_doc\_freq": 1  
}  
}  
}

what is wrong with our first query?  
Elasticsearch version: 5.5.1

---

<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:** [September 13, 2017, 1:06pm UTC](https://discuss.elastic.co/t/using-more-like-this-query-with-documents-containing-nested-objects/97259/2 "2017-09-13T13:06:32Z")

</div>

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