Does NEST support updating index analysis? - elasticsearch

As written in the elasticSearch documentation here, it's possible to define a new analysis for an index (I tried and it worked fine).
I was wondering if it was possible to perform the same thing with NEST?
I tried this:
ElasticClient.CloseIndex("myindex");
IndexSettings ndxSettings = ElasticClient.GetIndexSettings("myindex").Settings;
ndxSettings.Analysis.Analyzers.Add("snbowball", new SnowballAnalyzer());
var r = ElasticClient.UpdateSettings("myindex", ndxSettings);
ElasticClient.OpenIndex("myindex");
No error but nothing has changed.
When I try to see if the analyser has been added:
var getResponse = ElasticClient.GetIndexSettings("myindex");
getResponse.Settings.Analysis.Analyzers contains nothing.

You're doing the right thing, but analysis settings currently aren't on the UpdateWhiteList in NEST:
https://github.com/Mpdreamz/NEST/blob/master/src/Nest/Domain/Settings/IndexSettings.cs

Related

meta fields using elasticsearch-dsl

I'm looking at the changelog for the elasticsearch-dsl python library, and one of the comments says:
you can no longer access meta fields on a Document instance by
specifying ._id or similar. Instead all access needs to happen via the
.meta attribute.
Can I get a little more color on that? My old (5.x) code did this
self._id = a_nice_natural_identiifer
How should that be replaced?
self.meta._id = a_nice_natural_identifier
or
self.meta['_id'] = a_nice_natural_identifier
or
self.meta['id'] = a_nice_natural_identifier
It appears that the correct answer is
self.meta['id'] = a_nice_natural_identifier
(Interestingly, you can also set meta properties at construction time by doing)
foo = SomeSubclassOfDocument(_id=a_nice_natural_identifier)

Map().set() does not add element in Collection, using NativeScript

I recently have had a problem when coding using NativeScript.
I tried using Map() object as a Collection, but its set() method seems not to work.
I use the following snippet :
var r = new Map();
r.set("one", "two");
console.dir(r);
It however outputs an empty Map(), and I do not know why...
For your convenience, here is a link to a NativeScript PlayGround: https://play.nativescript.org/?template=play-ng&id=evhIxX&v=2
I inserted the snippet inside home.components.ts
Thanks alot!
LMy
Actually it works, if you try r.get("one") then you will see two in console.
May be console.dir does not handle Map as expected. You may report that in the GitHub project.

Trying to use the GET API to retrieve single term with elasticsearch and the JAVA API

I am new to elasticsearch but I am very close to getting the term, but I'm missing some small detail and I can't figure out what it is.
GetRequest getRequest = new GetRequest("registered", "users", id);
client.get(getRequest);
getRequest.storedFields("age");
GetResponse getResponse = client.get(getRequest);
String pw = getResponse.getField("age").getValue();
writer.println(getRequest);
When I try to run the above code I get a "nullPointerException". I have looked over the doc for the GET API https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-document-get.html but am getting nowhere. Any help someone could provide would be greatly appreciated.
what is the purpose of these two lines in the code ?
client.get(getRequest);
getRequest.storedFields("age");
I think this might be causing issues

Object doesn't get updated after calling SaveAsync on Parse Unity 1.6.2

I have a column ("DataDict") storing type of Dictionary (let say the variable name is call "dataDict")
Recently I've updated to Parse Unity 1.6.2 and I found out that whenever I make an update to dataDict, it doesn't get updated to the server.
For example:
Dictionary<string, object> dict = ParseUser.CurrentUser["DataDict"] as Dictionary<string, object>;
dict["name"] = "something new";
// after I call ParseUser.CurrentUser.SaveAsync()
// the server should have updated the dictionary
// but it's no longer working as what I expected after I've updated to Parse 1.6.2
Does anyone know what's going on?
I noticed one of the keypoint that listed in the changelogs:
Removed 'mutable containers' functionality, significantly enhances performance.
Does this affected my codes? How should I fix it?
I've solved this by calling
ParseUser.CurrentUser["DataDict"] = dict;

Has ElasticClient.TryConnect been removed from NEST?

Here's a code snippet we've used in the past to ping an Elastic Search node, just to check if it's there:
Nest.ElasticClient client; // has been initialized
ConnectionStatus connStatus;
client.TryConnect(out connStatus);
var isHealthy = connStatus.Success;
It looks like ElasticClient.TryConnect has been removed in NEST 0.11.5. Is it completely gone or has it just been moved to somewhere else just like MapRaw/CreateIndexRaw?
In case it's been removed, here's what I'm planning to do instead:
Nest.ElasticClient client; // has been initialized
var connectionStatus = client.Connection.GetSync("/");
var isHealthy = connectionStatus.Success;
Looks like this works - or is there a better way to replace TryConnect?
yes they have. See the release notes:
https://github.com/Mpdreamz/NEST/releases/tag/0.11.5.0
Excerpt from the release notes:
Removed IsValid and TryConnect()
The first 2 features of ElasticClient I wrote nearly three years ago which seemed like a good idea at the time. TryConnect() and .IsValid() are two confusing ways to check if your node is up, RootNodeInfo() now returns a mapped response of the info elasticsearch returns when you hit a node at the root (version, lucene_version etc), or you can call client.Raw.MainGet() or perhaps even better client.Raw.MainHead() or even client.Connection.HeadSync("/").
You catch my drift: with so many ways of querying the root .IsValid and TryConnect() is just fluff that only introduces confusion.

Resources