How can I only return results which have a notable type?
IE when I have the default example:
https://www.googleapis.com/freebase/v1/search?query=nirvana&indent=true
It normally returns something like:
{
"mid": "/m/015k7",
"name": "Gautama Buddha",
"notable": {
"name": "Deity",
"id": "/religion/deity"
},
"lang": "en",
"score": 24.125902
}...
which is perfect, but sometimes it doesn't have a notable type and returns only:
{
"mid": "/m/01rkx5",
"name": "Mahayana Mahaparinirvana Sutra",
"lang": "en",
"score": 22.350945
},
How can i filter out all results except those that have a notable type?
I tried setting
filter = (all notable) but it expects (all notable:something)
any ideas?
Currently, its not possible to filter search results based on whether notable types exists. I've passed your suggestion on to the Freebase engineers and they'll considering whether to add this in a future release of the Search API.
Related
The problem I am having is :
Sharepoint Get File Files (Properties Only) can only do one filter for ODATA, not a a second AND clause so I need to use Filter Array to make secondary filter work. And it does work....
But now I need to take my filtered array and somehow get the {FullPath} property and get the file content via passing a path and I get this error...
[ {
"#odata.etag": ""1"",
"ItemInternalId": "120",
"ID": 120,
"Modified": "2022-03-21T15:03:31Z",
"Editor": {
"#odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|dev#email.com",
"DisplayName": "Bob dole",
"Email": "dev#email.com",
"Picture": "https://company.sharepoint.us/sites/devtest/_layouts/15/UserPhoto.aspx?Size=L&AccountName=dev#email.com",
"Department": "Information Technology",
"JobTitle": "Senior Applications Developer II"
},
"Editor#Claims": "data",
"Created": "2022-03-21T15:03:31Z",
"Author": {
"#odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|dev#email.com",
"DisplayName": "Bob Dole",
"Email": "dev#email.com",
"Picture": "https://company.sharepoint.us/sites/devtest/_layouts/15/UserPhoto.aspx?Size=L&AccountName=dev#email.com",
"Department": "Information Technology",
"JobTitle": "Senior Applications Developer II"
},
"Author#Claims": "i:0#.f|membership|dev#email.com",
"OData__DisplayName": "",
"{Identifier}": "Shared%2bDocuments%252fSDS%252fFiles%252fA10_NICKEL%2bVANADIUM%2bPRODUCT_PIS-USA_French.pdf",
"{IsFolder}": false,
"{Thumbnail}": ...DATA,
"{Link}": "https://company.sharepoint.us/sites/devtest/Shared%20Documents/SDS/Files/A10_NICKEL%20VANADIUM%20PRODUCT_PIS-USA_French.pdf",
"{Name}": "A10_NICKEL VANADIUM PRODUCT_PIS-USA_French",
"{FilenameWithExtension}": "A10_NICKEL VANADIUM PRODUCT_PIS-USA_French.pdf",
"{Path}": "Shared Documents/SDS/Files/",
"{FullPath}": "Shared Documents/SDS/Files/A10_NICKEL VANADIUM PRODUCT_PIS-USA_French.pdf",
"{IsCheckedOut}": false,
"{VersionNumber}": "1.0" } ]
So from what I can see, I think it's what I thought. Even though you're filtering an array down to a single element, you need to treat it like an array.
I'm going to make an assumption that you're always going to retrieve a single item as a result of your filter step.
I created a variable (SharePoint Documents) to store your "filtered" array so I could then do the work to extract the {FullPath} property.
I then created variable that is initialised with the first (again, I'm making the assumption that your filter will only ever return a single element) and used this expression ...
variables('SharePoint Documents')?[0]['{FullPath}']
This is the result and you can use that in your next step to get the file content from SharePoint ...
If my assumption is wrong and you can have more than one then you'll need to throw it in a loop and do the same sort of thing ...
This is the expression contained within ...
items('For_Each_in_Array')['{FullPath}']
Result ...
I actually ended up doing this and it works.
How should i design a Restful API for PATCH operation that support update some property in the a list with condition?
say i have following json model:
{
"key1": "value",
"key2": "value",
"list": [
{
"property": "someValue",
"toBePatched": "value"
},
{
"property": "otherValue",
"toBePatched": "value"
}
]
}
I need to patch the "toBePatched" property in the list when the "property" equals to "someValue". By looking at the json patch here, i think it is a good way to go, but i dont think the json pointer supports the query? how should i define a path that supports "/list/property=someValue/toBePatch"?
One stupid way to do it is to pass it as query parameter to the api, and have some logic around it, but i dont think thats a standard way to do it.
[
{ "op": "test", "path": "/list/0/property", "value": "someValue"},
{ "op": "test", "path": "/list/0/toBePatched", "value": "value"},
{ "op": "replace", "path": "/list/0/toBePatched", "value": "the-new-value"}
]
test is important, it lets you verify that the server hasn't change the part of the document that you are intending to change. See section 5 on Error Handling for details.
When I search with only birthData in fhir I am getting results.
For example: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_pretty=true&birthdate=2020-03-16 will return patient who has birthdate as 2020-03-16.
When I am searching with _content I am not getting any results. Something like this:
http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?_content=2019-09-05
_content is for searching text content.
If you want to search for dates you need to use a date search parameter. E.g.:
http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?birthDate=2019-09-05
This can be achieved using Search Parameters.
Search parameters are essentially named paths within resources that are indexed by the system so that they can be used to find resources that match a given criteria.
Using Search parameter
we can add additional search parameters that will index fields that do not have a standard search parameter defined.
we can add additional search parameters that will index extensions used by your clients.
we can disable search parameters
Example:
Lets say I have a PractitionerRole
"resourceType": "PractitionerRole",
"id": "6639",
"meta": {
"versionId": "1",
"lastUpdated": "2020-03-19T13:26:34.748+05:30",
"source": "#aYyeIlv9Yutudiwy"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"<http://www.w3.org/1999/xhtml\">foo</div>">
},
"active": true,
"practitioner": {
"reference": "Practitioner/6607"
},
"organization": {
"reference": "Organization/6528"
},
"specialty": [
{
"coding": [
{
"system": "<http://snomed.info/sct",>
"code": "42343242",
"display": "Clinical immunology"
}
]
}
]
}
PractitionerRole has thier own search parameters. Apart from those search parameters we wanted to have a search parameter which will filter all practitioner roles based on practitioner.reference. We can achieve this using Search parameters. All we need to do is creating a new search parameter just like below.
{
"resourceType": "SearchParameter",
"title": "Practitioner Referecene",
"base": [ "PractitionerRole" ],
"status": "active",
"code": "practitioner_reference",
"type": "token",
"expression": "PractitionerRole.practitioner.reference",
"xpathUsage": "normal"
}
Here what fhir tells is when user wanted to filter with practitioner_reference then look for PractitionerRole.practitioner.reference.
This looks something like this:
http://localhost:8080/hapi-fhir-jpaserver/fhir/PractitionerRole?practitioner_reference=Practitioner/6607
We can also extend this to search with multiple parameters. We can create a search parameter with or condition so that it can search with multi parameters.
"resourceType": "SearchParameter",
"title": "Patient Multi Search",
"base": [ "Patient" ],
"status": "active",
"code": "pcontent",
"type": "token",
"expression": "Patient.managingOrganization.reference|Patient.birthDate|Patient.address[0].city",
"xpathUsage": "normal"
}
Above SearchParameter will search withPatient.managingOrganization.reference or Patient.birthDate or Patient.address[0].city.
The query looks like this:
Search With City → http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?pcontent=Bruenmouth
Search With Birth Date → http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient?pcontent=2019-04-06
I have updated document in the elastic search. after update using I am fetching the same document by using their ID. It is giving me following response:
{
"_index": "b123456",
"_type": "documents",
"_id": "bltde56dd11ba998bab",
"_version": 3,
"found": true,
"_source": {
"title": "index.json",
"url": "/index1",
"tags": [],
"created_at": "2018-06-19T05:02:38.174Z",
"updated_at": "2018-06-19T05:07:57.155Z",
"version": 1,
"fields": [{
"uid": "fname",
"value": "john"
},
{
"uid": "lname",
"value": "test"
}
],
"class": "first"
}
}
After I am using update_by_query to update document I am sending following request to update_by_query:
{
"script": {
"source": "ctx._source.title = params.title;ctx._source.url = params.url;ctx._source.created_at = params.created_at;ctx._source.updated_at = params.updated_at;ctx._source.version = params.version;ctx._source.fields = params.fields",
"params": {
"title": "Demo title",
"url": "/demo",
"created_at": "2018-06-19T05:02:38.174Z",
"updated_at": "2018-06-19T05:07:57.155Z",
"version": 2,
"fields": [{
"uid": "fname",
"value": "vicky"
},
{
"uid": "lname",
"value": "test"
}
]
}
},
"query": {
"bool": {
"must": [{
"term": {
"_id": "bltde56dd11ba998bab"
}
},
{
"range": {
"version": {
"lt": 2
}
}
}
]
}
}
}
But it is giving me status code:409 and following error:
[documents][bltde56dd11ba998bab]: version conflict, current version
[3] is different than the one provided [2]
My document also contain custom version key.
Can anyone help me into this
For the sake of posterity, I'll submit an answer to this old question. The issue is occurring because ElasticSearch's internal version value in the _version field is actually 3 in your initial response, not 1.
You are then trying to update the document to using external version value 2, Elastic sees this as a conflict, as internally it thinks version 3 is the most up-to-date version, not version 1. Effectively, something as caused your external version scheme and Elastic's internal version scheme to become out-of-sync.
Also note, the following parameter should be included in your update calls to indicate that the operation should follow the rules for external versioning as opposed to Elastic's internal versioning scheme.
"version_type":external
There is a subtle but important distinction that needs to be made by specifying this parameter.
With version_type set to external, Elasticsearch will store the
version number as given and will not increment it. Also, instead of
checking for an exact match, Elasticsearch will only return a version
collision error if the version currently stored is greater or equal to
the one in the indexing command.
More information can be on Elastic's version can be found in their blog post
for me, it was document id. I am using node js elastic-search client, when I create a document I need to pass a document Id,
I was getting version conflict because I was trying to create multiple documents with the same id.
await elasticWrapper.client.create({
index: ElasticIndexs.Payments,
id: data.id, // <-- id should be unique
body: {
...data,
},
});
``
I need to import google contacts to my application. For that I try to use the Google People API but I didn't find an option to get the contacts custom fields.
Is it possible to get contact custom fields with the new Google People API?
Should I use the old Google Contacts API for that?
Thanks!
Request the userDefined projection with your personFields.
String url = "https://people.googleapis.com/v1/people/me/connections" +
"?personFields=names,emailAddresses,userDefined";
The response looks like this:
"userDefined": [
{
"metadata": {
"primary": true,
"source": {
"type": "CONTACT",
"id": "5629e24b082d1a66"
}
},
"key": "label1",
"value": "foo"
},
{
"metadata": {
"source": {
"type": "CONTACT",
"id": "5629e24b082d1a66"
}
},
"key": "label2",
"value": "bar"
}
]
For more details, see https://developers.google.com/people/api/rest/v1/people#Person.UserDefined
You can also update custom fields even though the documentation does not currently list userDefined as a valid field for updatePersonFields as the field mask.
https://developers.google.com/people/api/rest/v1/people/updateContact