How to store and retrieve messages in Openfire server according to threadid

We are using Openfire as server with various clients in mobile platform and web interface for which we are using xmppframework for iOS Smack for Android and Strophe.js for the web.

Following this http://xmpp.org/extensions/xep-0085.html#bizrules-threads we are sending messages with different thread values to start a new thread. But we noticed that while archiving through the Monitor plugin available for Openfire the details like thread is not stored. In server the auto archive mode is on.

How can we store the the messages according to the threadid and also query the Archive according to these threads ?