Question

Solr dynamic fields appear as searchable in Solr and available in the Thrift interface, but when using CQL, the fields don't appear. Is there a specific search style or querying style that can be used to expose what the dynamic fields are and their values?

Was it helpful?

Solution

Through CQL3 Dynamic fields should work as well with a few caveats.

  1. You need to declare the type as a map (eg: dyn_ map) and create the CQL schema.
  2. Post your schema with the dynamic type declared.
  3. The dynamic part isn't inferred inside the map by the name of the container (the map). So you need to include the dynamic part in the data. This also means that the key part has to be a text type.

So in the above example you'll have a map that looks like this:

'dyn_' : {dyn_1 : 1, dyn_2 : 2, dyn_3 : 3}

In the future we're talking about removing the limitation on the text type and allowing other types, but right now this is how it works for indexing.

We also use the special field to store dynamic field names, this query:

'_dynFld:dyn_1'

Should return one result from the above example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top