Hello Everyone,
I want to add a new field mapping in existing index. The new field called 'transactions' is supposed to be an array of objects. Below is the sample 'transactions' field I want to store.
TRANSACTIONS :[
{
ControlNumber :
{
orderSummary : {
orderNumber : 98,
orderDate : "",
scheduledQuantity :"",
startDate : ""
},
orderLineItems : {
identificationCode : [1,2,3,4],
unitOfMeasurement : [EA,EA,EA,EA],
GTINNumber : [23,45,67,321],
forecastDate : ["","","",""]
},
selected : true
}
},
{
ControlNumber : {
orderSummary : {
orderNumber : 99,
orderDate : "",
scheduledQuantity :"",
startDate : ""
},
orderLineItems : {
identificationCode : [1,2,3,4],
unitOfMeasurement : [EA,EA,EA,EA],
GTINNumber : [23,45,67,321],
forecastDate : ["","","",""]
}
}},
{
ControlNumber : {
orderSummary : {
orderNumber : 100,
orderDate : "",
scheduledQuantity :"",
startDate : ""
},
orderLineItems : {
identificationCode : [1,2,3,4],
unitOfMeasurement : [EA,EA,EA,EA],
GTINNumber : [23,45,67,321],
forecastDate : ["","","",""]
}
}
]
The type of objects in the 'transactions' array can be of 10 different types depending on 10 types of orders I have. So these fields inside these objects do not have a pre defined structure, that is the reason I did not specify the fields in detail.
Below is my mapping.
```PUT editxns/_mapping
{
"dynamic" : false,
"properties" :{
"transactions":{
"type" : "nested",
"properties" : {
"controlNumber" : {
"type" : "nested",
"properties":{
"orderSummary":{
"type" : "nested"
},
"orderLineItems":{
"type" : "nested"
}
}
}
}
}
}
}```
ControlNumber will always have 2 sub objects called "orderSummary" and "orderLineItemDetails". Each of these 2 sub objects will have a key and corresponding value will be an array of strings or integers.
My question is that if I do not define mappings of these arrays because they can vary depening on 10 different order types, will I be able to include those arrays in search ?
Please let me know if you need any further details or if my question is not clear.