Hi Luca,

The configuration index.analysis.analyzer.default_index is already set so I 
don't think there's a need to specify my mappings since I actually want to 
use the comma analyzer for all the fields. And from what I understand, that 
default_index is also applied to _all field. 
As you could see in my gist, I also overrode the "standard" analyzer since 
I doubted something went wrong with defaul_index. 

You may ask about the default_search configuration, my query "123456" is 
rather simple so I don't think the default analyzer would make any changes 
on it (and yes, I did verify that using the Analyzer API).

Even if there's something wrong with my settings, that still doesn't 
clearly explain why I got the result with the second document but not with 
the first one. 


On Monday, 31 March 2014 19:45:42 UTC+8, Luca Cavanna wrote:
>
> As far as I can see from your recreation you only create the analyzer but 
> don't associate it to your fields by specifying your mappings. Also, when 
> you query you don't soecify the field you want to query, thus you are using 
> the _all which has its own analyzer, which means that even if you had 
> specified the proper mappings the query would execute against a different 
> field with a different analyzer.
>
> On Monday, March 31, 2014 12:12:37 PM UTC+2, Huy Phan wrote:
>>
>> Hi all,
>>
>> I bumped into this weird behavior of Elasticsearch: 
>> https://gist.github.com/huyphan/9888959<https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fhuyphan%2F9888959&sa=D&sntz=1&usg=AFQjCNH4SNtSUHvK2yfyGrFL2mqfyD-vIQ>
>>
>> Basically what I did is to create a comma analyzer and and use it as the 
>> default one. Then I indexed this document
>>
>> {
>>     "random_string" : "ABC,XYZ",
>>     "random_number" : "123456,7890123",
>>     "random_email"  : "[email protected],[email protected]"
>> }
>>
>>
>> Then search for it with query "123456", I got no hit. However if I did 
>> everything from scratch and indexed a slightly different document (it's 
>> actually the same doc with first field removed):
>>
>> {
>>     "random_number" : "123456,7890123",
>>     "random_email"  : "[email protected],[email protected]"
>> }
>>
>>  
>> The same old query did give me the result. I'm not sure what is the 
>> difference between the 2 documents that causes this behavior.
>>
>>
>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/9b25e5f4-22a2-48e0-8ab2-4c72f4d8d25e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to