Ivan,

*Online Javadoc? Is there such a unicorn? :)*
>

Hahaha! Yes, there are some older versions (19.X, and also 20.1 Beta) but 
nothing later. I don't use them for the actual descriptive writeup (which 
is usually quite barren), but find them very useful to check class and 
method names during migrations. And then, what's missing from the Javadoc 
is usually filled in very nicely by the excellent and helpful ES folks such 
as yourself, so it always ends well for me!
 

>
> *I find the issues on Github to be more complete, but even though, some 
> changes are not properly tagged:*
>
>
> *https://github.com/elasticsearch/elasticsearch/issues?direction=desc&labels=v0.90.8%2Cbreaking&milestone=&page=1&sort=updated&state=closed*<https://github.com/elasticsearch/elasticsearch/issues?direction=desc&labels=v0.90.8%2Cbreaking&milestone=&page=1&sort=updated&state=closed>
>

At 
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodes.java

I found this useful example of iterating across the ImmutableOpenMap class:

    public DiscoveryNode findByAddress(TransportAddress address) {
        for (ObjectCursor<DiscoveryNode> cursor : nodes.values()) {
            DiscoveryNode node = cursor.value;
            if (node.address().equals(address)) {
                return node;
            }
        }
        return null;
    }



>
> *Luckily, most breaking code changes are easy to fix.*
>

Indeed, this was the case. Only one of my Java source files that use ES 
(out of 110) needed to be modified. Found some snippets on github to help 
with the migration. Next is to verify that it actually works, now that it 
compiles. Here's my full svn diff:

 import org.elasticsearch.cluster.metadata.IndexMetaData;
 import org.elasticsearch.cluster.metadata.MappingMetaData;
+import org.elasticsearch.common.collect.ImmutableOpenMap;
+import org.elasticsearch.common.hppc.cursors.ObjectCursor;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 
 import com.cequint.nameid.database.sort.SortSchema;
@@ -237,7 +239,7 @@
     currentIndex = indexMetaData.getIndex();
     indices.add(currentIndex);
 
-    Map<String, MappingMetaData> mp = indexMetaData.getMappings();
+    ImmutableOpenMap<String, MappingMetaData> mp = 
indexMetaData.getMappings();
 
     /* For all top-level field mappings */
     String indexTypeName = null;
@@ -249,14 +251,15 @@
     String fieldSubType = null;
 
     /* Iterate across all types */
-    for (Map.Entry<String, MappingMetaData> typeCursor : mp.entrySet())
+    for (ObjectCursor<MappingMetaData> typeCursor : mp.values())
     {
-      indexTypeName = typeCursor.getKey();
+      MappingMetaData mmd = typeCursor.value;
+      indexTypeName = mmd.type();
 
       try
       {
-        for (Map.Entry<String, Object> propsCursor : typeCursor.getValue()
-            .getSourceAsMap().entrySet())
+        for (Map.Entry<String, Object> propsCursor : mmd.getSourceAsMap()
+            .entrySet())
 

Regards,
Brian

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b9c84d33-4d2f-422e-9c2f-a4c0661a263a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to