I am using version 5.0 of Nest with ElasticSearch. I have an object which looks like this:
[ElasticsearchType(IdProperty = "messageId")]
public class Message
{
public Message() { }
public string messageId { get; set; }
public string conversationId { get; set; }
public dynamic context { get; set; }
}
As you can see, I am trying to have a very dynamic
object - where context could contain any kind of data.
Will this work? What is the best way to work with dynamic types in ElasticSearch?
I need to be able to query the data using the data within context
.
For example, context
could contain any kind of property and even hierarchical data.
Examples:
{
Name: "Billy Bob",
Age: 12,
Zip: 33312,
Interests: ["cars","planes","rockets"]
}
Another example:
{
Name: "Jill Smith",
Age: 32,
Zip: 33312,
Occupation: "Developer",
Children:[
{
Name:"Martha",
Age: 12
},
{
Name:"John",
Activity: "Dancing"
},
]
}