I'm using Search Query By Example using RawQueryByExampleDefinition from the ML Java API. Before we upgraded to version 8, passing in a dynamic options like the below works (focus on the element name):
<options xmlns="http://marklogic.com/appservices/search">
<sort-order collation="http://marklogic.com/collation/en/S1/EO/CU/MO" type="xs:string" direction="ascending">
<element ns="" name="dynamicElement"/>
</sort-order>
</options>
The above works for ML 7 without any element range index configured. However, for ML 8, this gives me an error and after digging into the cause, it appears that creating an element range index is now required, else ML Java API will throw an error.
My problem is the elements ingested into ML from my API are not really predetermined or schemaless, which means they (client) can insert any JSON format. Is there a way to create an element range index dynamically or programmatically so that the system will first check the passed in "schemaless" data and add element range indexes on the fly based on the passed in JSON structure or elements?