Reputation: 20916
I'm trying to map a multi field in elasticsearch
For example:
"findings": {
"type": "multi_field",
"fields": {
"in": {
"type": "string"
},
"orig": {
"type": "string",
"index":"not_analyzed"
}
}
Once I create this and query this is how it looks.
When index = 'no' does it mean the field will never be indexed at all?
"findings": {
"type": "string",
"index": "no",
"fields": {
"in": {
"type": "string"
},
"orig": {
"type": "string",
"index": "not_analyzed"
}
}
Upvotes: 0
Views: 3875
Reputation: 16355
Multi_fields have been removed from elasticsearch for long.
Instead, any of the core field types (excluding object and nested) now accept a fields parameter, as also shown in OP's second example.
However, When you specify fields
inside any other field, it simply means copying the content to a different field and apply a different set of analyzers for querying on the same content.
So when you specify index=no
, the field is not indexed as such and hence is not searchable but the inner fields have properties of their own.
You may also use copy_to
to copy the content to other fields and specify the different analyzers there but then there is no 'explicit' relationship between the two fields which is pretty explicit in multi_fields as new fields are accessed as 'findings.in'
or 'findings.orig'
Upvotes: 2
Reputation: 7649
"index" : "no"
has got different meaning for different types. Since findings
field in your question is String
it has following meaning according to elasticsearch documentation
.
no means that it won’t be searchable at all (as an individual field; it may still be included in _all). Setting to no disables include_in_all.
you can not directly search for the field findings
as it has got index: no
while you can search it using findings.in
or findings.orig
You can study more about index
property here
Upvotes: 0