I have populated Azure search data using my application and this is what is present in Search Explorer in portal.azure.com.
{
"#odata.context": "https://demosearch.search.windows.net/indexes('<indexname>')/$metadata#docs(*)",
"value": [
{
"#search.score": 1,
"id": "31",
"code": "C001105",
"title": "Demo Course Title 1",
"creator": "FILE_UPLOAD",
"events": [
{
"eventId": 97,
"eventStatus": "PLANNING",
"evtSession": [
{
"postCode": "AB10 1AB",
"townOrCity": "Aberdeen City,",
"dates": {
"from": "2022-08-11T08:00:00Z",
"to": "2022-08-11T11:00:00Z"
}
}
]
}
]
},
{
"#search.score": 1,
"id": "45",
"code": "C001125",
"title": "Demo Course Title 2",
"creator": "FILE_UPLOAD",
"events": [
{
"eventId": 98,
"eventStatus": "IN_PROGRESS",
"evtSession": [
{
"postCode": "BA10 0AN",
"townOrCity": "Bruton",
"dates": {
"from": "2022-08-11T08:00:00Z",
"to": "2022-08-11T09:30:00Z"
}
}
]
}
]
}
],
"#odata.nextLink": "https://demosearch.search.windows.net/indexes('<indexname>')/docs?api-version=2019-05-06&search=%2A&$skip=50"
}
I'm trying below curl to get data where ["townOrCity": "Aberdeen City,"] from Azure search.
curl --location --request POST 'https://demosearch.search.windows.net/indexes/<indexname>/docs/search?api-version=2019-05-06' \
--header 'api-key: XXXX' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{"count":false,"top":0,"skip":30,"search":"*","orderby":"search.score() desc","filter":"( events/any(evt: evt/evtSession/any(session: search.in(session/townOrCity, '\''Aberdeen City,'\'', '\'','\'') ) ) )","facets":["events/evtSession/townOrCity,count:10000"],"queryType":"full","searchMode":"any"}'
but I'm not getting expected response and value is coming as empty array :
RESPONSE
{
"#odata.context": "https://demosearch.search.windows.net/indexes('<indexname>')/$metadata#docs(*)",
"#search.facets": {
"events/evtSession/townOrCity": []
},
"value": []
}
Please help with the correct payload I should be using to filter out the record with "townOrCity" : "Aberdeen City," OR am I doing something wrong with indexing config or anything ?
"townOrCity" : "Aberdeen City,"
Edit 1:
NOTE: comma mentioned after Aberdeen City causes the issue. If I try same thing witout the comma everything works like a charm. But requirement is to support the comma.
$filter=( events/any(evt: evt/evtSession/any(session: search.in(session/townOrCity, 'Aberdeen City,', ',') ) ) )
there is data present in index but still its not applying filter properly, instead giving no record in response.
This works :
$filter=( events/any(evt: evt/evtSession/any(session: search.in(session/townOrCity, 'Aberdeen City,', '|') ) ) )
There are two overloads of the search.in function:
search.in(variable, valueList)
search.in(variable, valueList, delimiters)
Due to delimeters, comma inside my valueList was removed and hence actual value got changed. Apparently its an exact-match so empty response returned.
https://learn.microsoft.com/en-us/azure/search/search-query-odata-search-in-function
I would like to add the Databricks init script API in my exsiting bash script. How can I do this? Here is the API provided by Databricks:
curl -n -X POST -H 'Content-Type: application/json' -d '{
"cluster_id": "",
"num_workers": 1,
"spark_version": "8.4.x-scala2.12",
"node_type_id": "$node_type",
"cluster_log_conf": {
"dbfs" : {
"destination": "dbfs:/cluster-logs"
}
},
"init_scripts": [ {
"dbfs": {
"destination": "dbfs:/FileStore/shared_uploads/kafka_keytabs/CopyKrbFiles.sh"
}
} ]
}' https://<databricks-instance>/api/2.0/clusters/edit
I have pdns server 4.2.3. I want to change name of A record by api. Example:
test1 A ttl 60 192.168.1.2 -> test2 A ttl 60 192.168.1.2
From the powerdns host:
To delete record:
curl -X PATCH --data '{"rrsets": [{"changetype": "DELETE", "type": "A", "name": "test1.fqdn."}]}' -H 'X-API-Key: TURBOSECRET' http://127.0.0.1:8081/api/v1/servers/localhost/zones/zonename. -s | jq .
To add record:
curl -X PATCH --data '{"rrsets": [{"changetype": "REPLACE", "type": "A", "name": "test2.fqdn.", "ttl": "60", "records": [{"content": "test2.fqdn.", "disabled": false}]}]}' -H 'X-API-Key: TURBOSECRET' http://127.0.0.1:8081/api/v1/servers/localhost/zones/zonename. -s | jq .
Please adjust accordingly TURBOSECRET, fqdn and zonename.
I'm trying to use field filtering to pick out specific nested fields, and it seems to me like I'm hitting a limit for nesting.
Here's the filter I'm using: items(date_added, track(name, album(artists(name))))
and here's the curl command I'm trying (built with the new developer console):
curl -X "GET" "https://api.spotify.com/v1/users/<user_id>/playlists/<playlist_id>/tracks?fields=items(date_added%2C%20track(name%2C%20album(artists(name))))" -H "Accept: application/json" -H "Content-Type: application/json"
This call works and everything looks good until it gets to the artists field. It doesn't seem to be filtering down artist fields. I just want the artist name in this case. Here's a snippet of what I'm getting back:
"items": [
{
"track": {
"album": {
"artists": [
{
"external_urls": {
"spotify": "https://open.spotify.com/artist/3t69c5VItBx3GCrnkcYHEL"
},
"href": "https://api.spotify.com/v1/artists/3t69c5VItBx3GCrnkcYHEL",
"id": "3t69c5VItBx3GCrnkcYHEL",
"name": "Imagined Herbal Flows",
"type": "artist",
"uri": "spotify:artist:3t69c5VItBx3GCrnkcYHEL"
}
]
},
"name": "Floating"
}
}...
];
As you can see, I'm getting the full artist object. Can someone help me understand why I can't filter the fields for that?
Am trying to run multiline curl command in shell but not able to run it
curl -XPUT 'elk.***.com:9200/_snapshot/my_backup' \
{
"type": "fs",
"settings": {
"location": "/elkprod_bak/elkback",
"compress": true
}
}
You need to use the -d switch on the command line like this:
curl -XPUT 'elk.***.com:9200/_snapshot/my_backup' -d '{
"type": "fs",
"settings": {
"location": "/elkprod_bak/elkback",
"compress": true
}
}'