Why mapping does not work as respect?


#1

ElasticSearch 6.3

I create one index call [myindex3]. It's mapping look like below.

{
"myindex3": {
"mappings": {
"_doc": {
"properties": {
"tags": {
"type": "long"
}
}
}
}
}
}

I can create docs which has string value in the [tags] filed . See below:

{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "myindex3",
"_type": "_doc",
"_id": "2",
"_score": 1,
"_source": {
"tags": "123"
}
},
{
"_index": "myindex3",
"_type": "_doc",
"_id": "1",
"_score": 1,
"_source": {
"tags": 123
}
}
]
}
}


#2

May be I know the answer. I check the elasticsearch logic. ElasticSearch will transform the "string" value into long value. If it transfer the value successfully,error will not be throw! And the stored filed will pack the whole doc into one value which will be stored in lucene's one field!


(system) #3

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