My field type is "not_analyzed". I researched many similar issues but these solutions not affected. I'm trying to search exact value of field and getting aggregations. But aggregation returns splitted string.
Example: Asset Sale and Purchase Agreement => "[Asset", "Sale", "and", "Purchase", "Agreement"]
Also .raw field is empty. How to set .raw field value?
in search term "document_type_raw" => "Asset Sale and Purchase Agreement" returns empty. But "document_type_raw" => "sale" returns a result.
My ES version info is:
"number" : "1.7.2",
"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
My mapping is:
$mapping = [
"properties" => [
"metadata" => [
"dynamic_templates" => [
"strings" => [
"match_mapping_type" => "string",
"match" => "*",
"mapping" => [
"type" => "string",
"index" => "not_analyzed"
]
]
],
"properties" => [
"contract_name" => [
"type" => "string",
"analyzer" => "english",
"fields" => [
"raw" => [
"type" => "string",
"index" => "not_analyzed"
]
]
],
"open_contracting_id" => [
"type" => "string",
"index" => "not_analyzed"
],
"country_name" => [
"type" => "string",
"index" => "not_analyzed"
],
"country_code" => [
"type" => "string"
],
"signature_year" => [
"type" => "string"
],
"signature_date" => [
'type' => 'date',
'format' => 'dateOptionalTime',
],
"resource" => [
"type" => "string"
],
"resource_raw" => [
"type" => "string",
'index' => 'not_analyzed'
],
"file_size" => [
"type" => "integer",
],
"language" => [
"type" => "string"
],
"category" => [
"type" => "string"
],
'contract_type_raw' =>
[
'type' => 'string',
"index" => "not_analyzed",
'include_in_all' => "false"
],
'document_type_raw' =>
[
'type' => 'keyword',
"index" => "not_analyzed",
'include_in_all' => "false"
],
"contract_type" => [
"type" => "string",
"index" => "not_analyzed"
],
'document_type' =>
[
'type' => 'string',
"fields" => [
"raw" => [
"type" => "string",
"index" => "not_analyzed"
]
]
],
"company_name" => [
"type" => "string",
"fields" => [
"raw" => [
"type" => "string",
"index" => "not_analyzed"
]
]
],
"corporate_grouping" => [
"type" => "string",
"index" => "not_analyzed"
]
]
],
"annotations_category" => [
"type" => "string",
"index" => "not_analyzed"
],
"metadata_string" => [
"type" => "string"
],
"pdf_text_string" => [
"type" => "string"
],
"annotations_string" => [
"type" => "string"
]
]
];
Real mapping:
"master" : {
"properties" : {
"metadata" : {
"properties" : {
"category" : {
"type" : "string"
},
"company_name" : {
"type" : "string"
},
"contract_name" : {
"type" : "string"
},
"contract_type" : {
"type" : "string"
},
"contract_type_raw" : {
"type" : "string"
},
"country_code" : {
"type" : "string"
},
"country_name" : {
"type" : "string"
},
"district_id" : {
"type" : "string"
},
"document_type" : {
"type" : "string"
},
"document_type_raw" : {
"type" : "string"
},
"file_size" : {
"type" : "long"
},
"language" : {
"type" : "string"
},
"open_contracting_id" : {
"type" : "string"
},
"parent_id" : {
"type" : "string"
},
"province_id" : {
"type" : "string"
},
"resource" : {
"type" : "string"
},
"resource_raw" : {
"type" : "string"
},
"show_pdf_text" : {
"type" : "string"
},
"signature_date" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"signature_year" : {
"type" : "string"
}
}
},
"metadata_string" : {
"type" : "string"
},
"pdf_text_string" : {
"type" : "string"
}
}
}
},
"settings" : {
"index" : {
"creation_date" : "1490038552133",
"number_of_shards" : "5",
"uuid" : "itB8Ns-5TNKRRBSFojymiQ",
"version" : {
"created" : "1070299"
},
"number_of_replicas" : "1"
}
}
Thank you! Very much.