Good day to all!
We are struggling with what seems like a potential problem with ES and
searching for data in fields. To simplify I reduced some documents to only
the
salient points. Consider the following two simply documents:
test1:
{
"field1":"LANG000000904",
"field2":"LANG000000904"
}
test2:
{
"field1":"monkey",
"field2":"LANG000000904"
}
I placed the documents into an index called /test/type with names 1 and 2
respectively.
The mapping for this comes out with string type for both fields.
{
"test": {
"type": {
"properties": {
"field1": {
"type": "string"
},
"field2": {
"type": "string"
}
}
}
}
}
Note that field1 contains LANG000000904 in the first document and *monkey
*in the second.
Now when I search for LANG000000904 i get 0 hits:
curl -s 'http://localhost:9200/test/type/_search?pretty' -d '{ "query" : {
"term" : { "field1":"LANG000000904" } } }'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
However searching for monkey i get one result as expected:
curl -s 'http://localhost:9200/test/type/_search?pretty' -d '{ "query" :
{ "term" : { "field1":"monkey" } } }'
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "type",
"_id" : "2",
"_score" : 1.0, "_source" : {
"field1":"monkey",
"field2":"LANG000000904"
}
} ]
}
}
It seems to me that the first search for LANG000000904 should return 1
hit for document 1, but it seems that the alphanumeric string is somehow
not found while the purely alphabetic string is found .... Are we missing
something that would make this work correctly?
Additionally we tested the GET URI requests for searching and those appear
to be working as expected:
curl -s
'http://localhost:9200/test/type/_search?q=field1:LANG000000904&pretty'
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "type",
"_id" : "1",
"_score" : 1.0, "_source" : {
"field1":"LANG000000904",
"field2":"LANG000000904"
}
} ]
}
}
It seems that perhaps there is something not working correctly with
POST/JSON
query, but perhaps we are not doing it right.
Any comments and ideas would be much appreciated.
Thanks,
--
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.
For more options, visit https://groups.google.com/groups/opt_out.