'_all' vs 'copy_to' space variation


(anusha) #1

Hello Team,
I am using '_all' for to group different fields data together, in which when I load data it is occupying disk space 3 times i.e., without using '_all' to hold different field data init it my index took 5mb space after data loaded init,

If I use the '_all' mappings as shown..
"_all": {
"index_analyzer": "wordAnalyzer",
"search_analyzer": "whitespace_analyzer"
},
"properties": {
"Engine": {
"type": "string",
"index": "not_analyzed",
"fields": {
"raw": {
"type": "string"
}
}
},
"EngineCode": {
"type": "string",
"include_in_all": false
},
"Make": {
"type": "string",
"index": "not_analyzed",
"fields": {
"raw": {
"type": "string"
}
}
},
"MakeCode": {
"type": "string",
"include_in_all": false
},
"Model": {
"type": "string",
"index": "not_analyzed",
"norms": {
"enabled": true
},
"fields": {
"raw": {
"type": "string"
}
}
},
"ModelCode": {
"type": "string",
"include_in_all": false
},
"ShortYear": {
"type": "string",
"index": "not_analyzed",
},
"Year": {
"type": "string",
"index": "not_analyzed",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"YearCode": {
"type": "string",
"include_in_all": false
}
}
}

When I load data occupying 25 mb sapce..

I have tried with 'copy_to' field then it is occupying 15mb space and the settings with 'copy_to' as shown:
"demoymme_type": {
"properties": {
"Engine": {
"type": "string",
"index": "not_analyzed",
"fields": {
"raw": {
"type": "string"
}
},
"copy_to": [
"full_name"
]
},
"EngineCode": {
"type": "string"
},
"Make": {
"type": "string",
"index": "not_analyzed",
"fields": {
"raw": {
"type": "string"
}
},
"copy_to": [
"full_name"
]
},
"MakeCode": {
"type": "string"
},
"Model": {
"type": "string",
"index": "not_analyzed",
"fields": {
"raw": {
"type": "string"
}
},
"copy_to": [
"full_name"
]
},
"ModelCode": {
"type": "string"
},
"ShortYear": {
"type": "string",
"index": "not_analyzed",
},
"Year": {
"type": "string",
"index": "not_analyzed",
"norms": {
"enabled": true
},
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
},
"copy_to": [
"full_name"
]
},
"YearCode": {
"type": "string"
},
"full_name": {
"type": "string",
"index_analyzer": "wordAnalyzer",
"search_analyzer": "whitespace_analyzer"
}
}
}
May I know the difference b/w '_all' and 'copy_to'??


(anusha) #2

And I would like to know which one is the best approach to combine different field data into one field and search on it????


(David Pilato) #3

Use copy_to! And disable _all

Definitely better. You'll have a better control.


(anusha) #4

Thanks David :slight_smile:


(system) #5