Hello everybody,
I'm using a dynamic template in order to peruse 2 versions of each field -
an analysed one, and a non-analysed one. Elasticsearch 0.90.7 with no
plugins, HTTP transport.
This is the mapping for the type in question:
{
"journal": {
"dynamic_templates": [
{
"default": {
"mapping": {
"fields": {
"{name}": {
"index": "analyzed",
"type": "{dynamic_type}",
"store": "no"
},
"exact": {
"index": "not_analyzed",
"type": "{dynamic_type}",
"store": "yes"
}
},
"type": "multi_field"
},
"match": "*",
"match_mapping_type": "string"
}
}
],
"properties": {
"admin": {
"properties": {
"owner": {
"type": "multi_field",
"fields": {
"owner": {
"type": "string"
},
"exact": {
"type": "string",
"index": "not_analyzed",
"store": true,
"omit_norms": true,
"index_options": "docs",
"include_in_all": false
}
}
}
}
}
}
}
}
So each journal has an admin object, which has an owner key, which is a
string. So far, so good.
The problem is that this query works:
POST /index_name/journal/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"admin.owner.exact": "1892042X"
}
}
]
}
}
}
returns 5 journals which have admin.owner set to that exact value.
But this one does not!
POST /index_name/journal/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"admin.owner": "1892042X"
}
}
]
}
}
}
Note that the .exact suffix is missing. The thing is, why doesn't ES match
this? There's no whitespace or anything like that, it's just 8 characters
next to each other. (Not to mention I'd have expected it to match if the
stored value in the 5 records was "1892042X more tokens".)
I can obviously use .exact to get what I want, but I want to understand how
ES works in this regard, at least to some basic degree...
Thanks,
Emanuil
P.S. I also ran some _explain-s against one of the records which should
match. I ran the exact same queries, but against
/index_name/journal/a_journal_id/_explain . Here are the results:
(using .exact):
{
"ok": true,
"_index": "index_name",
"_type": "journal",
"_id": "a_journal_id",
"matched": true,
"explanation": {
"value": 13.024077,
"description": "sum of:",
"details": [
{
"value": 12.947296,
"description": "weight(admin.owner.exact:1892042X in 37942)
[PerFieldSimilarity], result of:",
"details": [
{
"value": 12.947296,
"description": "score(doc=37942,freq=1.0 =
termFreq=1.0\n), product of:",
"details": [
{
"value": 0.99704796,
"description": "queryWeight, product of:",
"details": [
{
"value": 12.98563,
"description": "idf(docFreq=2,
maxDocs=481298)"
},
{
"value": 0.07678087,
"description": "queryNorm"
}
]
},
{
"value": 12.98563,
"description": "fieldWeight in 37942, product of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 12.98563,
"description": "idf(docFreq=2,
maxDocs=481298)"
},
{
"value": 1,
"description": "fieldNorm(doc=37942)"
}
]
}
]
}
]
},
{
"value": 0.07678087,
"description": "ConstantScore(:), product of:",
"details": [
{
"value": 1,
"description": "boost"
},
{
"value": 0.07678087,
"description": "queryNorm"
}
]
}
]
}
}
(without .exact, the analysed version of the field):
{
"ok": true,
"_index": "index_name",
"_type": "journal",
"_id": "a_journal_id",
"matched": false,
"explanation": {
"value": 0,
"description": "Failure to meet condition(s) of required/prohibited
clause(s)",
"details": [
{
"value": 0,
"description": "no match on required clause
(admin.owner:1892042X)"
},
{
"value": 0.07082304,
"description": "ConstantScore(:), product of:",
"details": [
{
"value": 1,
"description": "boost"
},
{
"value": 0.07082304,
"description": "queryNorm"
}
]
}
]
}
}
I already know one is matching and the other isn't matching the doc, but I
can't divine the reason for it from those explain results.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/070b4634-343f-43e2-bfec-1216ee4d80a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.