Nest: how to add properties to objects for indexing?
See original GitHub issueSerilog sink for Elasticsearch defines a class LogEvent, fills its properties and sends it for indexing. This class has several top level scalar properties, but the most interesting part is the dictionary (name to value) of dynamic properties, which is declared like this:
[JsonProperty(PropertyName = "fields")]
public IDictionary<string, object> Properties { get; set; }
If there are dynamic properties “One” and “Two” what I get in Elasticsearch is “fields.One” and “fields.Two”.
The big question is how to get rid of “fields” prefix?? I want dynamic properties to be added at the top level and be accessible without any prefix, the same way as scalar properties of the class are.
I keep banging my head against the wall, but cannot figure how to do it. Could you help please?
Thank you! Konstantin
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Elasticsearch NEST add property to existing index
I would like to add a new property to an existing index that already contains documents. var client = new ElasticClient(settings); var ...
Read more >ES NEST - How to Create an index and Bulk ...
Hi, guys! I have a Dataset for which I don't know or have the type in advance, nor the number of properties or...
Read more >Indexing documents with the NEST Elasticsearch .NET client
There are a number of ways you can index documents into Elasticsearch using the NEST Elasticsearch .NET client.
Read more >Elasticsearch Mapping: The Basics, Updates & Examples
Within a search engine, mapping defines how a document is indexed and how it indexes and stores its fields. We can compare mapping...
Read more >How Can I Add a Key-Value Pair to a JavaScript Object?
You can add multiple properties at once or merge multiple iterables, such as objects. The merge is shallow: Any nested objects will not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Greg, I finally found one line solution! Just put [JsonExtensionData] attribute on the Dictionary<string, object> and desired behavior is achieved automagically!
Konstantin
Thank you, Greg! Sure, I will give it a try shortly!