Reputation: 100
I am new to elastic search and was trying to add a new type mapping in ElasticSearch using postman, but it returns status-403 error while adding type mapping.
What's wrong with this query and how it can be achieved?
http://IPADDRESSS/index/type/_mapping
{
"properties": {
"action_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"action_30_analyzed": {
"type": "string"
}
}
},
"controller_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"controller_30_analyzed": {
"type": "string"
}
}
},
"iPAddress_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"iPAddress_30_analyzed": {
"type": "string"
}
}
},
"itemId_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"itemId_30_analyzed": {
"type": "string"
}
}
},
"itemName_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"itemName_30_analyzed": {
"type": "string"
}
}
},
"id_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"id_30_analyzed": {
"type": "string"
}
}
},
"locationId_30": {
"type": "long"
},
"moduleId_30": {
"type": "long"
},
"moduleName_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"moduleName_30_analyzed": {
"type": "string"
}
}
},
"narration_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"narration_30_analyzed": {
"type": "string"
}
}
},
"timeStamp_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"timeStamp_30_analyzed": {
"type": "string"
}
}
},
"dateValue_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"timeStamp_30_analyzed": {
"type": "string"
}
}
},
"url_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"url_30_analyzed": {
"type": "string"
}
}
},
"userId_30": {
"type": "long"
},
"userName_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"userName_30_analyzed": {
"type": "string"
}
}
},
"value_30": {
"type": "string",
"index": "not_analyzed",
"fields": {
"value_30_analyzed": {
"type": "string"
}
}
}
}
}
Upvotes: 2
Views: 22752
Reputation: 1191
If you're using the Chrome-Apps version of Postman, then the problem could be because Chrome will automatically send an origin header which doesn't comply to the pattern to the CORS pattern in your elasticsearch.yml
.
You either need to disable the Chrome interceptor for the adding the origin header, or to adding the pattern to elasticsearch.yml
(see here). I solved this issue by downloading the Postman desktop version, which runs without Chrome.
Upvotes: 2
Reputation: 1941
Errors in the range 4XX are usually client errors. And in your case, 403 means Forbidden. The server understood the request but refuses to authorize it.
A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).
If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.
An origin server that wishes to "hide" the current existence of a forbidden target resource MAY instead respond with a status code of 404 Not Found.
Source https://httpstatuses.com/403
We don't know if there are any problems with your query yet until we get a response from elasticsearch. Here are a few recommendations If your elasticsearch cluster is running on the same node as your local machine try the following
If the elasticsearch cluster does not exist on your local machine, or you don't want to uninstall xpack try passing the Authorization token via the header. see how to do that here.
Upvotes: 2