Changing analyzer filters


(Rafael Almeida) #1

Hello,

I had the following analyzer on my elasticsearch configuration:

teste:
            type: custom
            tokenizer: standard
            filter: [standard]

A field named title uses that analyzer. I indexed ATLÉTICO using it.
Searching for ATLÉTICO works. Searching for atletico gives me no result.
Afterwards, I stoped elasticsearch and changed the analyzer to

teste:
            type: custom
            tokenizer: standard
            filter: [lowercase_pt, asciifolding, standard]

in the configuration file. Now, without reindexing anything, I searched for
"atletico" and the document was returned. That looks odd to me. Was the
document reindexed automatically? How did the query work? I used query
string to search for it and I specified that analyzer on it.

[]'s
Rafael

--
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/CAKCnWVn9gG8LiakK5%2BE454RZX26aAJvxeQW7biBzjPGMbop4hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(David Pilato) #2

Was the document reindexed automatically?
No.

It's hard to tell more without a full curl recreation with all the steps you did.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 mars 2014 à 21:55, Rafael Almeida almeidaraf@gmail.com a écrit :

Hello,

I had the following analyzer on my elasticsearch configuration:

teste:
            type: custom
            tokenizer: standard
            filter: [standard]

A field named title uses that analyzer. I indexed ATLÉTICO using it. Searching for ATLÉTICO works. Searching for atletico gives me no result. Afterwards, I stoped elasticsearch and changed the analyzer to

teste:
            type: custom
            tokenizer: standard
            filter: [lowercase_pt, asciifolding, standard]

in the configuration file. Now, without reindexing anything, I searched for "atletico" and the document was returned. That looks odd to me. Was the document reindexed automatically? How did the query work? I used query string to search for it and I specified that analyzer on it.

[]'s
Rafael

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/CAKCnWVn9gG8LiakK5%2BE454RZX26aAJvxeQW7biBzjPGMbop4hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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/49E60D10-E0D0-4221-9BD0-C75B4E7BE887%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.


(Rafael Almeida) #3

Right. Let me elaborate my question, then.

This is my analyzer at first:

        test:
            type: custom
            tokenizer: standard
            filter: [standard]

$ curl -XPUT 'http://localhost:1980/t';echo
{"ok":true,"acknowledged":true}
$ curl -XPUT 'http://localhost:1980/t/t/_mapping' -d'{"t": {"properties":
{"title": {"type":"string", "analyzer": "test"}}}}';echo
{"ok":true,"acknowledged":true}
$ curl -XPOST 'http://localhost:1980/t/t/1' -d'{"title": "ATLETICO"}';echo
{"ok":true,"_index":"t","_type":"t","_id":"1","_version":1}
$ curl -XPOST 'http://localhost:1980/t/_search?pretty' -d'{"query":
{"query_string": {"fields": ["title"], "query": "ATLETICO",
"analyzer":"test"}}}';echo
{
"took" : 44,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "t",
"_type" : "t",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"title": "ATLETICO"}
} ]
}
}
$ curl -XPOST 'http://localhost:1980/t/_search?pretty' -d'{"query":
{"query_string": {"fields": ["title"], "query": "atletico",
"analyzer":"test"}}}';echo
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

So far so good. Now I changed my analyzer to this (and restarted
elasticsearch):

        test:
            type: custom
            tokenizer: standard
            filter: [lowercase, standard]

Now that last query returns a result:

$ curl -XPOST 'http://localhost:1980/t/_search?pretty' -d'{"query":
{"query_string": {"fields": ["title"], "query": "atletico",
"analyzer":"test"}}}';echo
{
"took" : 45,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "t",
"_type" : "t",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"title": "ATLETICO"}
} ]
}
}

What's happening?

--
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/CAKCnWVn%3DhD30h8nEzw4fWxbqGcqD%3DAX%2BiJhg%3D%3D%2BSroXb%2BzRcag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4