Hello.
I have my index mapping with nested:
{
"index_test": {
"mappings": {
"search_type": {
"properties": {
"person": {
"properties": {
"relation": {
"properties": {
"subject": {
"type": "nested",
"properties": {
"firstName": {
"type": "keyword",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
} } },
"lastName": {
"type": "keyword",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
} } } } } } } } } }} } }
But I want to add new field 'organization' to my nested 'subject'. How should I do it?
I am using Java API:
/*
xContentBuilder.string = {
"search_type": {
"properties": {
"person.relation.subject.organization": {
"type": "keyword",
"fields": {
"english": {
"type": "text",
"analyzer": "english"
} } } } } }
*/
m_transportClient.admin().indices()
.preparePutMapping( "index_test")
.setType( "search_type" )
.setSource( xContentBuilder ).get();
gives me EXCEPTION: object mapping [person.relation.subject] can't be changed from nested to non-nested
How to add new field for mapping of nested object?