Newbie question on adding data

I am getting an error trying to add values to an index I created. My index is just a listing of companies, what type of texting they offer (SMS, MMS, etc.), the URL, and the date created.

Here's the index I created:

MAPPING
--------

PUT textingcompanyinfo
{
"mappings": {
"properties": {
"company":
{ "type": "text" },
"type_of_service": { "type": "text" },
"url": { "type": "text" },
"created": {
"type": "date",
"format": "yyyy-MM-dd||epoch_millis"
}
}
}
}

And, here's an example PUT

PUT http://localhost:9200/textingcompanyinfo/1
{
"company": "AT&T",
"type_of_service": "SMS",
"url": "number@txt.att.net" ,
"created":"2019-07-29"
}

--

But, I'm getting this error:

  {
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Rejecting mapping update to [textingcompanyinfo] as the final mapping would have more than 1 type: [_doc, 1]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Rejecting mapping update to [textingcompanyinfo] as the final mapping would have more than 1 type: [_doc, 1]"
    },
    "status": 400
}

--

Thanks in advance.

Hello!

Elasticsearch 7.0+ only permits to have one type for index and by default is _doc.

Now, in your put you are Specifying the type as "1". If what you want is to define the id of the doccument when indexing, you should do something like this:

PUT http://localhost:9200/textingcompanyinfo/_doc/1

1 Like

Thank you!

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