How to clone elasticsearch index to another index using python requests library? - rest

I am trying to do as in title with the following code:
resp = requests.post("http://es_7:9200/my-index/_clone/new-my-index")
And I get this error:
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://es_7:9200/my-index/_clone/new-my-index
Seems like it is not existing query, but as per docs it should work fine.
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clone-index.html
What may be the issue? Thanks in advance

This route was added in the release 7.4
Could it be you are using a prior release ?
I am using version 7.0.1 how to clone the index within this version?
To perform a clone like operation:
In the case you wish to perform a _clone artificially.
Say you have index1 as the original index and index2 being the clone,
I believe you have to :
Get the mappings and settings of index1
Create index2 with the said setting/mapping
_reindex the data from index1 to index2

Related

CRM D365 update polymorphic/multitable lookup via Plugin

I'm trying to update a polymorphic lookup column on a table via plugin code and it doesn't seem happening. Wondering what additional I’m missing.
var entity1Id = "af435c64-a264-4f2a-9cee-22069ce36b3c";
var destinationEntity = new Entity("bookableresourcebooking", new Guid(myBookingGuid));
destinationEntity["my_ploymorphiclookupid"] = new EntityReference("my_entity1", new Guid(entity1Id));
organizationService.Update(destinationEntity);
my_ploymorphiclookupid is a polymorphic lookup (N:1) to my_entity1
Code looks fine. If you didn’t see any runtime errors in plug-in trace log, then few diagnosis steps needed.
Check audit history of that record
Chances of any other plugin steps replacing the value back or rolling back
Try to profile/debug the plugin for clues

Can I use flutter to create an index on firestore?

I'm using the following flutter code to query firestore which orders the data using the field timestamp.
var results = Firestore.instance.collection('post').orderBy('timestamp').getDocuments().then((value) {
var list = value.documents;
return list.map((doc) {
return doc.documentID;
}).toList();
});
When I run this code, it throws the below exception saying an index is required:
W/Firestore(31110): (21.3.0) [Firestore]: Listen for Query(app/jQH7Fp9xCZWYiqZRe7lE/post where readAccess array_contains_any [WzKImODx6WYVqdSW3D9Az3xrUnM2, PUBLIC] order by -timestamp, -name) failed: Status{code=FAILED_PRECONDITION, description=The query requires an index. You can create it here: https://console.firebase.google.com/v1/r/project/....
The exception even comes with a nice link. When opening that link, a nice UI pops up giving me the ability to create the index, with just a simple click:
Question: simple as the above may seem, I'm not very happy with this. I prefer to be able to create the index from fluttercode. In code I'm looking for something like the below:
Firestore.instance.collection('post').API-TO-CREATE-INDEX('timestamp');
Does it exist? Please advise. Many thanks.
It's not possible to create an index from client apps. You have three main choices:
Clicking the link you already saw.
Using the Firebase CLI to deploy the index from the command line.
Using the gcloud CLI to also deploy from the command line
See also the documentation on managing indexes.

How to change settings of an index after creation in elastic4s?

I'd need to disable index refreshing for the course of a batch indexing (of gigabytes) and set it back again after it's done. But from the source code of elastic4s I can't find a way to do it other than at index creation time... Is it possible? Or is there a workaround for this?
In java client :
client
.admin
.indices()
.prepareUpdateSettings()
.setSettings(settings)
.setIndices(indexName)
.execute()
.actionGet()
Natively :
curl -XPUT 'localhost:9200/my_index/_settings' -d '
{
"index" : {
"refresh_interval" : -1
}
}
'
This is how you do it in elastic4s (for example setting the refresh interval property).
client.execute {
update settings "myindex" set Map("index.refresh_interval" -> "10s")
}
Note: Not all settings can be changed at runtime or after the index is created.
Note 2: I have added this API in response to your question, and is only available in version 1.5.1 onwards.
Note 3: I could back port it to 1.4.x or 1.3.x if required by anyone.

Azure Mobile Services Custom Identity Provider from Javascript App

I am trying to implement a custom identity provider in Azure Mobile services and I am using an HTML5/JS app to consume it. I am following Josh Twists post on the matter and I have it set up per his instructions. His blog post consumes the new identity table via objC.
I'm very new to this so please bear with me if it's something mundane that I missed. I apologize in advance.
I have successfully consumed other tables in the AMS using JS but this one is returning a Server 500 error. I have updated the Master Key with my own. And added the accounts table and the script he specifies on the insert function for that table.
Here's the JS I am using to try to call the table:
var item = {
username: $("#username").val(),
passowrd: $("#password").val(),
salt: "1234",
login: true
};
client.getTable("accounts").insert(item);
In this case client is my MobileServiceClient and I use the same client.getTable("").insert(obj) to insert into other tables and it works just fine.
One thing I do notice in the insert script I got from the blog is that it says there's an unexpected use of |= and ^.
function slowEquals(a, b) {
var diff = a.length ^ b.length;
for (var i = 0; i < a.length && i < b.length; i++) {
diff |= (a[i] ^ b[i]);
}
return diff === 0;
}
If anyone could help me understand where I am going wrong I would greatly appreciate it. Thank you for taking the time to read this.
EDIT: Thanks Josh. Didn't realize the logs were there. Ended up being an issue of not getting length of undefined... it was undefined because I passed passowrd instead of password. Thanks for your quick help.
Have you checked the logs (in the management portal) for details of the 500 error? Also, I have a web implementation here - http://doto.mobi/web (it's the web version of http://doto.mobi).
You can view source and see that it uses custom identity. It's not exactly the same backend but pretty close, should be a good head start.

Oracle UCM - ridc - get all versions of document

I am getting files from Oracle UCM via RIDC. I am using DataBinder as follows :
IdcClient client =getUCMConnection();
DataBinder dataBinder = client.createBinder ();
dataBinder.putLocal ("IdcService", "GET_FILE");
dataBinder.putLocal ("dID", dID);
IdcContext userContext = new IdcContext(username);
ServiceResponse response = client.sendRequest (userContext, dataBinder);
InputStream fstream = response.getResponseStream ();
....... etc.
I want to ask, how can I get "ALL VERSIONS" of a document instead of latest released one?
First you have to call the service DOC_INFO, you can get the result set of the revision by using the REVISION_HISTORY set.
You will get specific dID for each version, you iterate them and use GET_FILE with dID as a parameter for each one of them
I can't test it right now but I think the service you are looking for is GET_INFO, try it and check all the resultsets you get I'm pretty sure one of them has the info for all the document's revisions.
You can use the service REV_HISTORY to get the result set REVISIONS which contains info of all the revisions.