Help with text field mapping and implicit conversion of integer and boolean to text

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Describe the issue:
When I map a field as text (or keyword), if my request contains this field in a different type, opensearch converts it as text instead of throwing an error. I could not find any option to disable this, and accept only texts in a text field, is it possible?


PUT index-1/
"mappings": {
      "dynamic": "strict",
      "properties": {
        "field1": {
          "type": "text"

when sending:

POST index-1/_bulk
{"create": {}}
{"field1": 123545}

it does not return errors, instead saves the integer as text.

There’s no direct way to do this, but you may consider using ingest pipeline to fail the request if found that the field is not string, like this:

POST _ingest/pipeline/_simulate
  "pipeline" : {
    "processors": [
          "fail": {
    "if" : "ctx.field1 instanceof String == false",
    "message": "The field [field1] is not string, found value:{{field}}"
  "docs" : [
            "_source" : {