I created my index with the settings of my analyzer and it shows my analyzer settings when I call the index properties. When I try to use index something with the analyzer it throws an exception named " analyzer couldn't found". Here is my analyzer settings;
"settings":{
"index":{
"settings":{
"analysis":{
"filter":{
"turkce_lowercase":{
"type":"lowercase",
"language":"turkish"},
"turkce_stop":{
"type":"stop",
"stopwords_path":"/home/power/Documents/stop_words.txt"}
},
"analyzer":{
"turkce":{
"filter":["turkce_lowercase","turkce_stop"],
"tokenizer":"standard_tokenizer"}
},
"tokenizer":{
"standard_tokenizer":{
"type":"standard",
"max_token_length":"900"}
}
}
}
}
}
In your custom analyzer, you simply need to add "type": "custom" to denote that your analyzer is a custom analyzer and not a standard one.
"analyzer": {
"turkce": {
"type": "custom", <----- add this
"filter": [
"turkce_lowercase",
"turkce_stop"
],
"tokenizer": "standard_tokenizer"
}
}
Related
I'm using serilog with this configuration:
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
"MinimumLevel": "Debug",
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "./logs/performance-{Date}.log",
"rollingInterval": "Day",
"fileSizeLimitBytes": 1000,
"rollOnFileSizeLimit": true,
"retainedFileCountLimit": null,
"shared": true
}
}
]
}
}
Output file should look like 20210613-performance.log But output file looks like {Date}-performance20210613.log.
What i'm doing wrong?
The {Date} placeholder is not a feature of the Serilog.Sinks.File sink that you're using. You're probably confusing with the (deprecated) Serilog.Sinks.RollingFile sink which has this feature.
With Serilog.Sinks.File, at this time, you cannot define where the date will appear. It's always appended to the end of the file name you choose (and before the sequence number if you also are rolling by file size).
There have been attempts to implement this feature, but as of this writing it's not yet there.
I want to create new alerts(High CPU,RAM) for all AppServicePlans in a given subscription. I could not find Powershell commands to create new alerts. Is there a way we can create these alerts for all appserviceplans with a single script? May be using ARM template?
Sorry for pasting a direct answer, but I cannot yet comment. You get the error because in the documentation for Add-AzMetricAlertruleV2 it states: "$act is the output of New-AzActionGroup cmdlet". Meaning you need to use for example:
$act = New-AzActionGroup -ActionGroupId "testActionGroup"
After that you need to add it in the parameter -ActionGroup $act for it to work.
If you look at Resource Explorer and navigate to a manually created (near-realtime) alert, you should see the "critera" object defined like below. Here is a full example of a resource that seems to be working. Create some variables for each of your values:
{
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"name": "[variables('alertName')]",
"location": "global",
"dependsOn": [],
"tags": {
"[concat('hidden-link:', variables('applicationInsightsResourceId'))]": "Resource",
"[concat('hidden-link:', variables('webtestResourceId'))]": "Resource"
},
"properties": {
"description": "[concat('Alert for ', parameters('availibilityTestName'))]",
"severity": 4,
"enabled": true,
"scopes": [
"[variables('webtestResourceId')]",
"[variables('applicationInsightsResourceId')]"
],
"evaluationFrequency": "PT5M",
"windowSize": "PT15M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[variables('webtestResourceId')]",
"componentId": "[variables('applicationInsightsResourceId')]",
"failedLocationCount": 3
},
"actions": [
{
"actionGroupId": "[resourceId('microsoft.insights/actiongroups', 'webhook')]",
"webHookProperties": {
// Some properties to send to webhook
}
}
]
}
}
I'm trying to specifiy the constructor to use in autofac json configuration file.
By code a can use the UsingConstructor(...) method.
I tried different configuration but no one works.
Example of my tests :
{
"type": "BlueCurve.Search.Messaging.PubSub.Producer, BlueCurve.Search.Messaging",
"services": [
{
"type": "BlueCurve.Search.Messaging.Abstraction.IProducer, BlueCurve.Search.Messaging.Abstraction",
"constructor": "System.String, System.Guid, System.String, BlueCurve.Search.Messaging.Abstraction.IAmqpConnectionFactory"
}
]
}
{
"type": "BlueCurve.Search.Messaging.PubSub.Producer, BlueCurve.Search.Messaging",
"services": [
{
"type": "BlueCurve.Search.Messaging.Abstraction.IProducer, BlueCurve.Search.Messaging.Abstraction",
"using-constructor": "System.String, System.Guid, System.String, BlueCurve.Search.Messaging.Abstraction.IAmqpConnectionFactory"
}
]
}
{
"type": "BlueCurve.Search.Messaging.PubSub.Producer, BlueCurve.Search.Messaging",
"services": [
{
"type": "BlueCurve.Search.Messaging.Abstraction.IProducer, BlueCurve.Search.Messaging.Abstraction"
}
],
"using-constructor": "System.String, System.Guid, System.String, BlueCurve.Search.Messaging.Abstraction.IAmqpConnectionFactory"
}
Thanks you for your help!
JSON configuration doesn't support specifying constructor. Config isn't a feature for feature replacement for code based setup. See documentation here.
I'm trying to conditionally provide resource property values through translation of runtime resource properties within a copyIndex loop..
Upon deploying the following ARM template, I receive the error:
Unable to process template language expressions for resource '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vm-name}/extensions/Microsoft.EnterpriseCloud.Monitoring' at line '30' and column '10'. 'The template resource '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vm-name}' is not found.' (Code: InvalidTemplate)
"type": "[variables('extensionType')[reference(concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachines')[copyIndex()].name)).storageProfile.osDisk.osType]]",
However, the VM exists with the ID it provides, so it doesn't make sense that the engine cannot find it. If I hard-code the Extension Type, there are no errors and the Extension is installed on the VM with the same ID.
Unfortunately, I don't know if this is a bug within ARM or if I'm just doing something wrong..
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceResourceId": { "type": "string" },
"virtualMachines": { "type": "array" }
},
"variables": {
"extensionType": {
"Windows": "MicrosoftMonitoringAgent",
"Linux": "OmsAgentForLinux"
}
},
"resources": [
{
"copy": {
"name": "VMMonitoringExtensionsCopy",
"count": "[length(parameters('virtualMachines'))]"
},
"type": "Microsoft.Compute/virtualMachines/extensions",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('virtualMachines')[copyIndex()].location]",
"name": "[concat(parameters('virtualMachines')[copyIndex()].name, '/Microsoft.EnterpriseCloud.Monitoring')]",
"properties": {
"publisher": "Microsoft.EnterpriseCloud.Monitoring",
"type": "[variables('extensionType')[reference(concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachines')[copyIndex()].name)).storageProfile.osDisk.osType]]",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": true,
"settings": {
"workspaceId": "[reference(parameters('workspaceResourceId'), '2015-11-01-preview').customerId]"
},
"protectedSettings": {
"workspaceKey": "[listKeys(parameters('workspaceResourceId'), '2015-11-01-preview').primarySharedKey]"
}
}
}
]
}
The object array being passed in for virtualMachines looks like this:
[
{ "name": "vm-name", "location": "azure-region" }
]
A couple things you can try:
1) Assuming the VM is not defined in the same template try using the "full" resourceId in the reference function. See the last example in this doc:
https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-functions/#reference - it seems like the error already knows the full resourceId, but it's worth trying
2) the other thought is that the reference function is evaluated at runtime and the resource provider doesn't like the expression but that's a swag.
I will do some more poking and see if we can't nail this down.
I am trying to figure out an approach to delete all entries for a specific property in an elasticsearch index and remove all type mappings for that property.
I have been looking at the following two doc pages: put mapping and delete mapping
From second link:
"Allow to delete a mapping (type) along with its data. The REST
endpoint is /{index}/{type} with DELETE method."
What I think I need is a /{index}/{type}/{property}?
Do I need to recreate the whole index to accomplish this, i.e. moving and manipulating data between types?
For Example, calling GET on the mapping:
curl -XGET 'http://.../some_index/some_type/_mapping'
result:
{
"some_type": {
"properties": {
"propVal1": {
"type": "double",
"index": "analyzed"
},
"propVal2": {
"type": "string",
"analyzer": "keyword"
},
"propVal3": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
after this delete operation on propVal3 would return:
curl -XGET 'http://.../some_index/some_type/_mapping'
result:
{
"some_type": {
"properties": {
"propVal1": {
"type": "double",
"index": "analyzed"
},
"propVal2": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
and all data for propVal3 would be removed through the index.
You can not do that. Just forget that this value exists... ;-)
If you really need to remove it, you will have to reindex your documents.
You can use the new _reindex api for this, you could even PUT a new _mapping to the dest index before running the reindex so you can change the properties of the fields in your index.
To do a reindex and removing a property, you can do this:
POST /_reindex
{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter",
},
"script": {
"inline": "ctx._source.remove('whatever')"
}
}
if you would use this in combination with the _aliases API you can modify indexes without having any 'downtime'
It's not currently possible to remove a property from a mapping. In order to remove all values of a property from all records, you need to reindex all records with this property removed.
You can choose whats documents fields you will reindex to a new index. For example:
POST _reindex
{
"source": {
"index": "my-source-index",
"_source": ["host.hostname", "host.ip", "another_field"]
},
"dest": {
"index": "my-dest-index"
}
}
Reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-filter-source
Just want to add another approach for the case of "removing property from index".
POST pulse/_update_by_query
{
"query": {
"match_all": {}
},
"script": {
"source": "ctx._source.remove(\"file_id\")",
"lang": "painless"
}
}