0
votes

I have an index in elasticsearch with several custom analyzers for specific fields. Example:

"titulo" : {
   "type" : "string",
   "index_analyzer" : "analyzer_titulo",
   "search_analyzer" : "analyzer_titulo"
}

analyzer_titulo is this:

"analyzer_titulo":{
    "filter":[
        "standard",
        "lowercase",
        "asciifolding",
        "stop_filter",
        "filter_shingle",
        "stemmer_filter"
    ],
    "char_filter":[
        "html_strip"
    ],
    "tokenizer":"standard"
}

However when i try to use the _analyze api to test the analyzer for this field elasticsearch seems to ignore the custom analyzer: kopf analysis tab

As you can see both results are different but, if my understanding is correct, they should be the same.

What i am missing here? Is there a way to use the _explain api to see what analyzer is used?

PS: unfortunately i can't post my full mappings (company policy) but i only have one index and one type.

Thanks

1

1 Answers

0
votes

I'm not familiar with the tool you're using to test your analyser (don't know why it's not working), but what you can do is run a query that returns the values sitting in the index

curl 'http://localhost:9200/myindex/livros/_search?pretty=true' -d '{
    "query" : {
        "match_all" : { }
    },
    "script_fields": {
        "terms" : {
            "script": "doc[field].values",
            "params": {
                "field": "titulo"
            }
        }
    }
}'

If your type has many documents in it, then you'll want to change the match_all :{} to something more specific.