mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
cluster state to return native json (if possible) as part of the mappings
This commit is contained in:
parent
626989c55e
commit
a547c1ccc0
@ -33,6 +33,8 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsFilter;
|
import org.elasticsearch.common.settings.SettingsFilter;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
|
import org.elasticsearch.common.xcontent.builder.XContentBuilder;
|
||||||
import org.elasticsearch.rest.*;
|
import org.elasticsearch.rest.*;
|
||||||
import org.elasticsearch.rest.action.support.RestXContentBuilder;
|
import org.elasticsearch.rest.action.support.RestXContentBuilder;
|
||||||
@ -91,11 +93,14 @@ public class RestClusterStateAction extends BaseRestHandler {
|
|||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
||||||
builder.startObject("mappings");
|
builder.startArray("mappings");
|
||||||
for (Map.Entry<String, String> entry : indexMetaData.mappings().entrySet()) {
|
for (Map.Entry<String, String> entry : indexMetaData.mappings().entrySet()) {
|
||||||
builder.startObject(entry.getKey()).field("source", entry.getValue()).endObject();
|
XContentParser parser = XContentFactory.xContent(entry.getValue()).createParser(entry.getValue());
|
||||||
|
Map<String, Object> mapping = parser.map();
|
||||||
|
parser.close();
|
||||||
|
builder.map(mapping);
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endArray();
|
||||||
|
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user