Hi,
We test parent/child query and filter for one of our requirements. We have
100K parent object and about 20 M child objects which belongs to these
parent objects. A thread is adding more document as bulks continuously. In
this case my parent child query requests sent by TransportClient return with
timeout exception. I think this is because of existence of parent and child
objects on same index and continuously updating of child object type. It
hurts search performance of parent objects. is this comment correct? Do you
have any other suggestions to increase query performance?
I think it would be much better if we have a IN query instead of
parent/child query. In this way we can separate child index from parent
index and we can boost the performance of search operation done on parent
object. Currently we define hasChild query or filter as following using JAVA
api:
def filter = FilterBuilders.hasChildFilter("childobjecttype",
QueryBuilders.....)
def query = QueryBuilders.hasChildQuery("childobjecttype",
QueryBuilders.....)
we can modify this by just adding index as following:
def filter = FilterBuilders.hasChildFilter("childindex", "childobjecttype",
QueryBuilders.....)
def query = QueryBuilders.hasChildQuery("childindex", "childobjecttype",
QueryBuilders.....)
or index may not be mandatory and if it is not specified we can take the
index of parent type:
def filter = FilterBuilders.hasChildFilter("childobjecttype",
QueryBuilders.....)
filter.setIndex("childindex");
def query = QueryBuilders.hasChildQuery("childobjecttype",
QueryBuilders.....)
query*.setIndex("childindex");*
Or since one of the benefits of using parent/child mechanism is putting
parent and child data on same shard, we can leave as it is. We can give a
new name to this type of filter/queries as infilter/inQuery. This filter can
join two types as parent/child mechanism. It can be assumed that id of
related type will be written in any of properties of other type. We can
define filter as:
def filter = FilterBuilders.inFilter("type1index", "type1",
"relatedObjectIdPropetyInChild", QueryBuilders.....)
def query = QueryBuilders.inQuery("type1index", "type1",
"relatedObjectIdPropetyInChild", QueryBuilders.....**)
*
*Is this meaningful? *
*
Mustafa Sener
www.ifountain.com
WebRep
Overall rating