Ben
Ben

Reputation: 91

String query of unicode (emoji) character in Elastic Search

I have some articles in my ES index that contain emoji icons. I'd like to perform a search for articles that contain specific emoji characters. I'm using compose.io as my ES provider and via ElasticHQ I can see the emojis in the data - they are rendered as icons in OS X, so I assume the unicode is stored correctly. However, when I run this query I get no results. If I run a plain text search I do get my results. I'm using mongoosastic.

Article.search({query_string: {query: "😕"}},
            {fields: "title"}, 
            function(err, results) {
            if (err) {
                console.log("error: " + err);
            } else {    
                console.log("results: " + JSON.stringify(results));         
            }
        });

//results: {"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}

Upvotes: 2

Views: 1557

Answers (1)

Gautam S. Thakur
Gautam S. Thakur

Reputation: 71

Yes, it looks like ElasticSearch also cannot directly enables searching emoticons. Also, I tried using corresponding unicode value, and that also doesn't seems to work. May be converting raw unicode value to a string would help.

Upvotes: 1

Related Questions