I am posting to my nearly created Elasticsearch service, but unable to post the mapping. I can not identify which part is unsupported. Any suggestions?
{
"mappings": {
"employees": {
"properties": {
"FirstName": {
"type": "text"
},
"LastName": {
"type": "text"
},
"Designation": {
"type": "text"
},
"Salary": {
"type": "integer"
},
"DateOfJoining": {
"type": "date",
"format": "yyyy-MM-dd"
},
"Address": {
"type": "text"
},
"Gender": {
"type": "text"
},
"Age": {
"type": "integer"
},
"MaritalStatus": {
"type": "text"
},
"Interests": {
"type": "text"
}
}
}
}
}
I consistently get this error returned.
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]"
}
Using Version 7.6.2
As you didn't specify your Elasticsearch version, which I also asked in my comment,
I have multiple versions of Elasticsearch and as you are using text, I started with Elasticsearch 7 as, you also specified employees in your mapping, which created suspect as this is normally defined in older versions, where types are defined.
Please see removal of types official doc for more info and not it would be completely removed in coming major version of 8.X
I was able to reproduce the issue with Elasticsearch 7.6 and got the same error:
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]"
}
},
"status": 400
}
Solution
Simply remove the employee from your mapping and use below mapping.
{
"mappings": {
"properties": { --> note `employees` removed.
"FirstName": {
"type": "text"
},
"LastName": {
"type": "text"
},
"Designation": {
"type": "text"
},
"Salary": {
"type": "integer"
},
"DateOfJoining": {
"type": "date",
"format": "yyyy-MM-dd"
},
"Address": {
"type": "text"
},
"Gender": {
"type": "text"
},
"Age": {
"type": "integer"
},
"MaritalStatus": {
"type": "text"
},
"Interests": {
"type": "text"
}
}
}
}
Above create index successfully
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "mustnot"
}
You seem to be using version 7.x of Elasticsearch, which doesn't support mapping types anymore. You simply need to remove employees, like this:
{
"mappings": {
"properties": {
"FirstName": {
"type": "text"
},
"LastName": {
"type": "text"
},
"Designation": {
"type": "text"
},
"Salary": {
"type": "integer"
},
"DateOfJoining": {
"type": "date",
"format": "yyyy-MM-dd"
},
"Address": {
"type": "text"
},
"Gender": {
"type": "text"
},
"Age": {
"type": "integer"
},
"MaritalStatus": {
"type": "text"
},
"Interests": {
"type": "text"
}
}
}
}
I have http rest result in this format:
{
"type": "object",
"properties": {
"page": {
"type": "object",
"properties": {
"total": {
"type": "integer"
}
}
},
"list": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"status": {
"type": "string"
}
},
"required": [
"id",
"type",
"status"
]
}
}
}
}
I am trying to loop through each item in "list" and extract the id, type, status. How do I do this in MS Flow? Here is what I got:
As you can see the variables are not in the dynamic content picker, how do I get it to show up?
i'm using postman to communicate with elastic search server and i am receiving an error in postman when i am trying to connect with my elastic search server. Where could i have gone wrong?
Here is my code.
{
"mappings": {
"post": {
"properties": {
"city": {
"type": "text"
},
"contact_email": {
"type": "text"
},
"country": {
"type": "text"
},
"description": {
"type": "text"
},
"image": {
"type": "text"
},
"post_id": {
"type": "text"
},
"state_province": {
"type": "text"
},
"title": {
"type": "text"
}
}
}
}
}
i've tried communicating with my server but i keep receiving this error
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Root mapping definition has unsupported parameters: [post : {properties={country={type=text}, image={type=text}, post_id={type=text}, city={type=text}, description={type=text}, state_province={type=text}, title={type=text}, contact_email={type=text}}}]"
}
Seems like you are using elasticsearch version 7.0. Since elasticsearch no more support more than one mapping type per index, mapping name is no more required and should not be provided in this version.
Remove the mapping name post from the json input. Use as below:
{
"mappings": {
"properties": {
"city": {
"type": "text"
},
"contact_email": {
"type": "text"
},
"country": {
"type": "text"
},
"description": {
"type": "text"
},
"image": {
"type": "text"
},
"post_id": {
"type": "text"
},
"state_province": {
"type": "text"
},
"title": {
"type": "text"
}
}
}
}
My index structure is
{
"my_index": {
"mappings": {
"blogpost": {
"properties": {
"body": {
"type": "string"
},
"comments": {
"type": "nested",
"properties": {
"age": {
"type": "short"
},
"comment": {
"type": "string"
},
"date": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"name": {
"type": "string"
},
"stars": {
"type": "short"
}
}
},
"tags": {
"type": "string"
},
"title": {
"type": "string"
}
}
}
}
}
}
comments are nested objects. I want to update comment alone. But when I do partial update, ES is merging with existing comment object. I want to replace the existing comment with newer one. Is there anyway, We could configure ES to overwrite instead of merging nested object.
I tried posting a _bulk post into elastic search, but it throws:
{
"took": 1,
"errors": true,
"items": [
{
"index": {
"_index": "quick",
"_type": "parts",
"_id": "ACI250-2016",
"status": 400,
"error": {
"type": "mapper_parsing_exception",
"reason": "failed to parse [part]",
"caused_by": {
"type": "number_format_exception",
"reason": "For input string: \"250-2016\""
}
}
}
}
]
}
And here's what I'm trying to post:
POST _bulk
{"index":{"_index":"quick","_type":"parts","_id":"ACI250-2016"}}
{"eMfg":"ACI","part":"250-2016"}
And the map is:
{
"quick": {
"mappings": {
"parts": {
"properties": {
"app": {
"type": "string"
},
"eMfg": {
"type": "string"
},
"fPart": {
"type": "long"
},
"oPart": {
"type": "string"
},
"ofPart": {
"type": "string"
},
"part": {
"type": "long"
},
"price": {
"type": "double"
},
"title": {
"type": "string"
}
}
}
}
}
}
According to your mapping, part has type long and you're trying to send "250-2016". The reason might be that you've sent a document at some point with a part that was coercible to a number, e.g. "250" and now you're trying to send a string and it fails.
The best way is to use the mapping above to define a new index with the correct mapping type (see below) and then you can try your bulk import again.
DELETE /quick
PUT /quick
{
"mappings": {
"parts": {
"properties": {
"app": {
"type": "string"
},
"eMfg": {
"type": "string"
},
"fPart": {
"type": "long"
},
"oPart": {
"type": "string"
},
"ofPart": {
"type": "string"
},
"part": {
"type": "string" <-- change this
},
"price": {
"type": "double"
},
"title": {
"type": "string"
}
}
}
}
}