how to write to a given index-pattern in Kibana? - elasticsearch

I have a dotnet core project set up for Elasticsearch, Kibana and Logstash. Right now I just spit out random data to the log, but the thing is, that when I run the app then it automaticly runs on the same index-pattern under '_index' in the "Discover-section" in Kibana.
The question is - how in my code - do I define which index-pattern I want to connect to? I presume it is inside Program.cs inside main, but I am not sure how.
I want to be able to decide myself inside the app-code, which index-pattern I want to log to, if that makes sense.
Currently using serilog sinks. Is it in that direction, that I should fix it or am I looking in the wrong direction?
Update (trying to implement code from link given by mike b)
var connectionSettings =
new ConnectionSettings()
.DefaultIndex("defaultindex")
.DefaultMappingFor<Project>(m => m.IndexName("mycustomindex"));
var elasticClient = new ElasticClient(connectionSettings);
var searchResponse = elasticClient.Search<Project>();
Also I have created an index inside kibana, which will show, when I enter "GET _cat/indices", but when running the project and seeing that logs are received by kibana I still see that they are registered under the same old index ("httplog") as seen in the snippet below:
how do I change that - or what am I doing wrong?
PS: I can see the created index inside "Discover" / drop down menu, but it is empty for logs. Instead my httplog-index is filled with logs...

If you're using the .NET Elasticsearch client, it'll infer the name it thinks you want for an index. You can override that behavior or specify index names for specific index actions.
See: https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/index-name-inference.html

Related

Dynamic addition of fields in vespa

In Elastic Search, to add new fields while running the application we have to provide
"dynamic":true
More info about the same: https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html
Is there any functionality which can replicate same behaviour in Vespa? I was not able to find in vespa documentation.
Kindly help me in this regard. Thank you.
https://docs.vespa.ai/en/schemas.html#schema-modifications is the best place to start - just modify the schema with new fields and redeploy the application. The new fields can not have a default value, they are empty. It is not necessary to restart Vespa, this can be done on a running instance.
Dynamic fields automatically created from data is not supported in Vespa. You should not use this; it's a malfeature.
If the data in question is structured, you can often achieve what you need here by using a map. Otherwise, it's easy and safe to add new fields to the schema and redeploy.

How add Our Own Metric Expression in kibana(5.1.1)?

In Metric agg. by default we have Sum,count,avg,min,max,unique-count etc the functions I want to add my own customized function suppose sum/Unique_count how to implement it.
I guess it will required a code changes. Now currently all Kibana metrics are located there - https://github.com/elastic/kibana/tree/master/src/ui/public/agg_types/metrics. So, you need to clone Kibana at first, than add your_own_metric.js, which will be similar to other built-in metrics. Later on, you need to add your metrics to index.js, under https://github.com/elastic/kibana/blob/master/src/ui/public/agg_types/index.js and hopefully after you will build Kibana, you could use your custom version of it.
Some additional information - https://discuss.elastic.co/t/custom-metric-aggregation-plugin/70072/8

XPage view control search not working

I am new to domino designer and I am required to develop an application with it. I have went through some tutorials and I am stuck at the search function. I have followed guides I found but the search function in view control is not functioning. When I input anything into the search string(even static value), I get a server error 500. The error code is not very useful for solving my problem.(I have the full text index enabled.)
I tried to create my forms and views with the SiteFinderDemo template. I do not get an error but any search string returns 0 results.
I can modify the SiteFinderFinal's codes to work the way I want properly with the demo documents, but the search function else where just cannot work.
I also noticed new documents created with forms or xpages within the SiteFinderDemo instead of the agent do not work with the search function. I assume it has something to do with the full text searching, but I cannot find any information about it. What am I supposed to set up my application so that the search in view control can work without the server error, and what should I do to make new documents work with the search?
Thank you very much and sorry for such a long question.

Sitefinity: Where can I find the master GUID for a content item?

I'm building a web service for a client that pulls data from the Sitefinity CMS. The problem is they want to pass in a Guid for the service and receive the info about this item. No problem except I only have been able to locate the "live" Guid for one Item (and that was by combing through the HTML in the back end).
I was going to look at the tables in SQL Server but I'm not sure which table to look at. The content items have several tables all related of course and there isn't any documentation on how to look at this. I can find plenty of documentation on querying the master Guid, but no place to find it.
Oh, and these are custom content types built by the Module Builder.
Any Help would be SOOOOO appreciated!
var master = DynamicModuleManager.GetManager().Lifecycle.GetMaster(<liveGuidHere>);
One of the biggest consumers of Sitefinity webservices is Sitefinity. The best place to start looking for that guid is to take a look at what web service calls are being made when you pull up your custom content item list in the backend. I used the chrome developer tools and check in the network tab.
One I found for a stores module made with module builder was something to the effect of http://www.testsite.com/Sitefinity/Services/DynamicModules/Data.svc/?managerType=Telerik.Sitefinity.DynamicModules.DynamicModuleManager&providerName=OpenAccessProvider&itemType=Telerik.Sitefinity.DynamicTypes.Model.Stores.Store&provider=OpenAccessProvider&sortExpression=LastModified%20DESC&skip=0&take=50
The json this returns is a list of all the masters with their ids (note in the list that the content items all have have a status of 0) http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/content-lifecycle
When you go to Administration / Module Builder / Your Module, you will see a link to the API on the top right corner.
This link goes to a page full of API examples for your particular module which is kind of cool.
Basically you would have to find your item first using LINQ and the GetValue extension method.
Once you have the item you can get its ID or any other property.
using Telerik.Sitefinity.Utilities.TypeConverters;
using Telerik.Sitefinity.DynamicModules;
using Telerik.Sitefinity.Model;
....
var mgr = DynamicModuleManager.GetManager();
var countrymasters = from ctry in mgr.GetDataItems(TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Destinations.Destination"))
where ctry.GetValue<string>("culture") == siteid &&
(ctry.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ctry.Visible == true)
select new
{
airport_cd = ctry.GetValue<string>("airport_cd"),
country_master_cd = ctry.GetValue<string>("country_master_cd")
};

How to correctly add constraints to the querybuilder node for CQ5 Reports

I'm working on creating a custom report report page in CQ5. I've got my reportbase and columnbase components set up correctly, by following the steps listed here. I am able to, for instance, pick up all the templates that are available, by setting the property nodeTypes to cq:Template
I want to add a constraint to it, say for example pick up templates whose jcr:title is foo. I created a node under querybuilder called propertyConstraints and added my constraints in the form of nodes below it, as describedhere. However, this does not work for me at all.
What is the correct way to add constraints to the querybuildernode? Has anyone tried this?
Also, once I get this working correctly, can I extend this example to return pages of a specific template?
Have you looked into the QueryBuilder API? Adobe's documentation discusses how to match 1 or more property values.
Create a node propertyConstraints under queryBuilder of type nt:unstructured
create another node under propertyConstraints with any name.
Add properties to this node :
name String jcr:title
value String foo

Resources