As the final mapping would have more than 1 type

Please with 6.2 how to overcome this issue :

reason=Rejecting mapping update to [stock] as the final mapping would have more than 1 type: [CUSTOMER, BRAND]]]

Code:
IndexRequest request = new IndexRequest(this.getName(), this.getType(), id);
request.source("{"field":"value"}", XContentType.JSON);

    //tag::migration-request-ctor-execution
   
    //end::migration-request-ctor-execution
   // assertEquals(RestStatus.CREATED, response.status())
	

		 IndexResponse response = client.index(request);
		// assertEquals(RestStatus.CREATED, response.status());

You can't have multiple types in your index.
Use _doc as the type.

Please do you have an example of indexing multiple table SQL to an index?

I am really confused

I'm also struggling with this, in most part because the documentation contradicts the advice here, but — as is often the case with documentation — offers few clues as to what to do, or how.

You're right. This part specifically should be removed all together: https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_index_management_operations.html#_put_mappings_api

That's sometimes the case in client libraries. It makes more time to get them consistent with the core. But again I agree here

Hi @dadoonet, I'm adapting an existing settings and mappings document, and there is no option for body in there — how would that work?

Instead of doing:

PUT index/type1/1
{
  "data1": "bar"
}
PUT index/type2/1
{
  "data2": "baz"
}

You can do:

PUT index_type1/_doc/1
{
  "data1": "bar"
}
PUT index_type2/_doc/1
{
  "data2": "baz"
}

Or:

PUT index/_doc/1
{
  "type": "type1",
  "type1": {
    "data1": "bar"
  }
}
PUT index/_doc/1
{
  "type": "type2",
  "type2": {
    "data2": "baz"
  }
}

That kind of thing for example.

1 Like

Again, I don't see how that applies to a settings and mappings documents.

Apologies for the length of the code, but for example, using: PUT localhost:9200/asset_en_v1

{
	"settings": {
		"analysis": {
			"char_filter": {
				"&_to_and": {
					"type": "mapping",
					"mappings": ["&=> and "]
				}
			},
			"filter": {
				"asset_en_stopwords": {
					"type": "stop",
					"stopwords": ["_english_"]
				},
				"asset_en_stemmer": {
					"type": "stemmer",
					"name": "english"
				},
				"asset_en_shingle": {
					"type": "shingle",
					"max_shingle_size": 5,
					"min_shingle_size": 2,
					"output_unigrams": false,
					"output_unigrams_if_no_shingles": true
				}
			},
			"analyzer": {
				"asset_en_analyzer": {
					"type": "custom",
					"char_filter": [ "html_strip", "&_to_and" ],
					"tokenizer": "standard",
					"filter": [ "asset_en_stopwords", "asset_en_stemmer", "lowercase", "asset_en_shingle", "asciifolding" ]
				}
			}
		}
	},
	"mappings": {
		"_default_": {
			"properties": {
				"user_id": {
					"type": "long"
				},
				"creation": {
					"type": "date",
					"format": "date_hour_minute_second"
				},
				"deleted": {
					"type": "integer"
				},
				"favourite": {
					"type": "integer"
				},
				"modification": {
					"type": "date",
					"format": "date_hour_minute_second"
				},
				"note": {
					"type": "text",
					"analyzer": "english",
					"fields": {
						"std": {
							"type": "text",
							"analyzer": "asset_en_analyzer",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "standard"
								}
							}
						}
					}
				},
				"title": {
					"type": "text",
					"analyzer": "english",
					"fields": {
						"std": {
							"type": "text",
							"analyzer": "asset_en_analyzer",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "standard"
								}
							}
						}
					}
				},
				"links_to_asset": {
					"type": "nested",
					"properties": {
						"note_link_id": {
							"type": "long"
						},
						"user_id": {
							"type": "long"
						},
						"creation": {
							"type": "date",
							"format": "date_hour_minute_second"
						},
						"modification": {
							"type": "date",
							"format": "date_hour_minute_second"
						},
						"to_asset": {
							"type": "integer"
						},
						"from_asset": {
							"type": "integer"
						},
						"comment": {
							"type": "text",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "asset_en_analyzer",
									"fields": {
										"std": {
											"type": "text",
											"analyzer": "standard"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"note": {
			"properties": {
				"user_id": {
					"type": "long"
				},
				"creation": {
					"type": "date",
					"format": "date_hour_minute_second"
				},
				"deleted": {
					"type": "integer"
				},
				"favourite": {
					"type": "integer"
				},
				"modification": {
					"type": "date",
					"format": "date_hour_minute_second"
				},
				"note": {
					"type": "text",
					"analyzer": "english",
					"fields": {
						"std": {
							"type": "text",
							"analyzer": "asset_en_analyzer",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "standard"
								}
							}
						}
					}
				},
				"title": {
					"type": "text",
					"analyzer": "english",
					"fields": {
						"std": {
							"type": "text",
							"analyzer": "asset_en_analyzer",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "standard"
								}
							}
						}
					}
				},
				"links_to_asset": {
					"type": "nested",
					"properties": {
						"note_link_id": {
							"type": "long"
						},
						"user_id": {
							"type": "long"
						},
						"creation": {
							"type": "date",
							"format": "date_hour_minute_second"
						},
						"modification": {
							"type": "date",
							"format": "date_hour_minute_second"
						},
						"to_asset": {
							"type": "integer"
						},
						"from_asset": {
							"type": "integer"
						},
						"comment": {
							"type": "text",
							"fields": {
								"std": {
									"type": "text",
									"analyzer": "asset_en_analyzer",
									"fields": {
										"std": {
											"type": "text",
											"analyzer": "standard"
										}
									}
								}
							}
						}
					}
				}
			}
		},
		"folder": {
			"properties": {
				"in_folder_id": {
					"type": "long"
				},
				"label": {
					"type": "integer"
				}
			}
		},
		"bookmark": {
			"properties": {
				"url": {
					"type": "text",
					"index": false
				},
				"publication_date": {
					"type": "date",
					"format": "date_hour_minute_second"
				}
			}
		},
		"message": {
			"properties": {
				"from": {
					"type": "text",
					"index": false
				},
				"seen": {
					"type": "text",
					"index": false
				}
			}
		}
	}
}

Please do you have an example of java rest with mysql tables,

example of idexing a real mysql database with the new version ?

@waynesmallman Do you mind moving your last answer to another thread like Help updating index for 6.* instead?

Thanks!

2 Likes

That's a too wide question. But yes I do have an example here: https://github.com/dadoonet/legacy-search/tree/01-direct

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.