Type of Keyword can support and maintain type e.g boolean, number


(Vassilis) #1

Hello,

I have an field (name of field "value") type of text

I noticed that when I put (insert) into that indexer a boolean type
e.g {"value" : true} or {"value" : 17} then the indexer keeps the type and returns me the json (document) with the type i put it in previously. same for an array e.g {"value": [12,13,14]}

Is that behaviour anywhere documented ? does E.S keep the json type somewhere internally and while it store the document as string (text), over serialization it sends it over with the correct json input type

index definition:

{
"configuration": {
"dynamic": "strict",
"_all": {
"enabled": true
},
"properties": {
"key": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"value": {
"type": "text",
"norms": false,
"fields": {
"raw": {
"type": "keyword",
"doc_values": false
}
}
}
}
}
}

Appreciate your input here


(Thomas Dasch) #2

Hey Delk13,

Could you possibly show your mapping and an example of your input and what is returned?

Thanks!


(Vassilis) #3

Input examples could be:

PUT my_index/1

{
"key" : "vasilis.key2",
"value" : [2,3,4]
}

or

{
"key" : "cw.vasilis.key2",
"value" : true
}

Those operations succeed and when I get back the documents (e.g using search api) the value json field is returned with the type I put it in


(Mark Walkom) #4

What's the actual mapping though.


(Vassilis) #5

look at the definition of mapper.

the type of the field "value" is TEXT


(Mark Walkom) #6

Then that is what it's being stored and returned as. There's nothing else happening here.


(system) #7

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