I'm currently evaluating the new Azure Search feature in Windows Azure. I'm wondering if there's a way to do a MoreLikeThis query similar to lucene/elasticsearch?—pass in a document text and get a list of documents that are similar to the passed in document. I know Azure Search uses elasticsearch in the background (Source).
I haven't found this anywhere in the API, but maybe I'm missing something hidden in the parameters. I think this is a very useful feature and it would be shame if it's not included.
Yes it comes in the new version of azure search : 2015-02-28-Preview
see here : http://azure.microsoft.com/en-us/documentation/articles/search-api-2015-02-28-preview/
moreLikeThis=[key]
Here a sample:
GET /indexes/[index name]/docs/suggest?[query parameters]
Host: [search service url]
accept: application/json
api-key: [admin key]
C#
Uri uri = new Uri(_serviceUri, "/indexes/catalog/docs/suggest?$filter=discontinuedDate eq null&$select=productNumber&search=" + Uri.EscapeDataString(searchText));
There's a sample project on Codeplex:
https://azuresearchadventureworksdemo.codeplex.com/
Suggestions (Azure Search API):
http://msdn.microsoft.com/en-us/library/azure/dn798936.aspx
(Azure Search API)
http://msdn.microsoft.com/en-us/library/azure/dn798927.aspx
Unfortunately this feature is not currently available in Azure Search.
See Pablo's comment on Scott Guthrie's blog.
I know that this is an antique question, but it's one of the first when googling for 'morelikethis azure search'.
Anyway, with the new API version 2019-05-06-Preview there is a new preview feature called moreLikeThis (not in the SDK yet) where you can pass in an id of an existing document (I know, not a text like the David asked for). E.g.
GET /indexes/[index]/docs?moreLikeThis=[documentId]&api-version=2019-05-06-Preview
You can filter the compared fields by defining a list of properties with the searchFields parameter, e.g.
GET /indexes/[index]/docs?moreLikeThis=[documentId]&searchFields=[field]&api-version=2019-05-06-Preview
Of course this can also be POSTed, for more details have a look here.
Related
I'm creating a Template Spec using Bicep, which works fine. Adding a custom UI to the Template Spec using a uiFormDefinition file also works. However, when I try to use the control 'Microsoft.Solutions.ArmApiControl' in the UI definition, it fails with the error Failed to create element of type: 'Microsoft.Solutions.ArmApiControl' named 'sqlCapabilities'. I found that I can get rid of the error by removing all referencing functions from the path property, like this:
{
"name": "sqlCapabilities",
"type": "Microsoft.Solutions.ArmApiControl",
"request": {
"method": "GET",
"path": "/subscriptions/34d76722-9b63-464d-b742-11bf072d1fc1/providers/Microsoft.Sql/locations/westeurope/capabilities?api-version=2021-11-01"
}
}
... but that doesn't actually seems to do anything. (And even if this would work the element wouldn't be very useful without referencing functions.)
While reading the documentation, I noticed there are two sandboxes in the Azure Portal for developing uiFormDefinition files:
https://portal.azure.com/#view/Microsoft_Azure_CreateUIDef/FormSandboxBlade (titled "Form view Sandbox"), which is linked to from the Create portal form page of the ARM template documentation using the shortlink https://aka.ms/form/sandbox.
https://portal.azure.com/#view/Microsoft_Azure_CreateUIDef/SandboxBlade (titled "Create UI Definition Sandbox"), which is linked to from the Create portal interface page of the Azure Managed Applications Documentation.
They look similar, but they use different schemas: the UI Definition sandbox uses https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json# and the Form sandbox uses https://schema.management.azure.com/schemas/2021-09-09/uiFormDefinition.schema.json. The Form sandbox also has a few additional options such as the ability to specify the "Package Type" and "CUID".
Both sandboxes have a list documenting UI elements, which both point to the same destination: the Azure Managed Applications documentation.
The thing is: when I use the "Create UI Definition Sandbox" the 'Microsoft.Solutions.ArmApiControl' UI element works fine, even when using referencing functions like location(). However, I can't use the resulting file with the Template Spec: it attaches OK but when trying to deploy the Template Spec in the Portal I get this error: Invalid UIFormDefinition Schema. Click here to fallback to default experience.
Using referencing functions and/or 'Microsoft.Solutions.ArmApiControl' in the "Form view Sandbox" results in the problems mentioned at the beginning of this question.
Experimenting further, it looks like all functions work in both sandboxes, with the exception of referencing functions like location(), resourceGroup() orsubscription(): those only appear to work in the UI definition sandbox. The same applies to some UI elements.
Perhaps I missed it, but I wasn't able to find where this behavior is documented.
Is there a way to use the referencing functions and Microsoft.Solutions.ArmApiControl in a form definition for a Template Spec? If so, how can I do that?
TL;DR - you can do what you want, take a look at this: https://techcommunity.microsoft.com/t5/azure-governance-and-management/using-azure-templatespecs-with-a-custom-ui/ba-p/3586173
Long version, there are 2 schemas/formats for portal ui (as you discovered), there is an "old" version CreateUIDefinition.MultiVm.json and a newer version uiFormDefinition.schema.json - the newer version is largely a superset of the old version... i.e. it supports all the old stuff and has some new stuff. This distinction is not well documented yet.
templateSpecs only support the "newer" schema.
That help?
I am searching for ways to use the Microsoft Graph SDK for uploading a file to SharePoint. Currently I cannot find any example.
Has anyone tried to use the SDK for uploading file to SharePoint before? Thanks a lot.
I think I have found it. Yay! Praise God!
https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/208
In general, the structure of the SDK calling pattern mirrors the REST API. The path is built up by objects representing resources in the Graph API, then the request is composed (by explicitly invoking 'request'), and the verb is specified ("getAsync", "addAsync", "updateAsync").
For instance, something like GET ~/sites/<site id>/drives would look like graphClient.Sites[<site id>].Drives.Request().GetAsync();
For creating resources, you first instantiate the resource and set any properties.
ListItem myListItem = new ListItem();
Then you build the request and specify the verb to be addAsync
ListItem responseItem = await graphClient.Sites[<site id>].Lists[<list id>].Items.Request().addAsync(myListItem);
Recently I needed to use the search REST API for a project, I found the documentation and do step by step as follows:
https://www.ibm.com/support/knowledgecenter/SSYJ99_8.5.0/Search-Rest-api/Search.html
But to search constraints, I use it according to the documentation, the results returned are incorrect.
Do I need to configure where in the portal to use search constraints ? I am using IBM WebSphere Portal 9 Build Level: 20161208-1058 2016-12-08 12:09 CF13. Thank you!
I use the link URL search REST API, as followed:
http://localhost:10039/wps/contenthandler/searchfeed/search?constraint=
{"type":"field", "id":"authoringtemplate", "values":["bidv-template-demo"]}
&queryLang=en
&locale=en
&resultLang=e
n&query=developer
&scope=com.ibm.lotus.search.ALL_SOURCES
&start=0
&results=10
I had read that the Azure Search .NET SDK uses NewtonSoft.Json to convert it's models to/from json in it's underlying REST API calls so I've been doing the same in my own app.
I have a simple app which creates a new Index using the .NET SDK. To do this, I was defining my Index in a json file, using the format outlined here https://learn.microsoft.com/en-us/rest/api/searchservice/create-index and then I was converting this to a Microsoft.Azure.Search.Models.Index object using Newtonsoft.
var index = JsonConvert.DeserializeObject<Microsoft.Azure.Search.Models.Index>(System.IO.File.ReadAllText("config.json");
This was working fine before I configured custom Analyzers, but now that I have custom Analyzers in my config, the Analyzers, Tokenizers, and TokenFilters are not being resolved into the correct types. ie. my custom Analyzer is being deserialized as a Microsoft.Azure.Search.Models.Analyzer, instead of Microsoft.Azure.Search.Models.CustomAnalyzer, same goes for the Tokenizers and TokenFilters, they are being deserialized into the base types.
Is there an easy way I can create an Index like this in the .NET SDK from a json file?
Unfortunately this is not an officially supported scenario. While it works for simple index definitions, we're working to understand what we need to do to be able to support all cases.
Please post your feature request on our User Voice page to help us prioritize: https://feedback.azure.com/forums/263029-azure-search
In the meantime, you might be able to get it working yourself by adapting the JsonSerializerSettings initialization code at the bottom of this file.
I'm trying to access the result of a GET request provided by Azure, as shown in the example : https://msdn.microsoft.com/sv-se/library/azure/dn820159.aspx
My problem is that the api-version is a mandatory argument, but I have no idea about what to write inside. I'm a bit lost with the Azure Batch documentation, it doesn't seem to be complete.
I found something in an Azure webpage : https://azure.microsoft.com/en-us/documentation/articles/search-api-versions/ and the api-version was api-version=2015-02-28. However, if I try it in my browser, I have this answer : "key":"Reason","value":"The specified api version string is invalid".
Any idea of what I can put inside the api-version parameter ?
Have a look here
As the time of this writing
The version of the Batch API described here is '2016-07-01.3.1', and
using that version is recommended where possible.
Earlier versions include '2016-02-01.3.0', '2015-12-01.2.1',
'2015-11-01.2.1', '2015-06-01.2.0', '2015-03-01.1.1', and
'2014-10-01.1.0'.
So try specifying '2016-07-01.3.1'