Elastic search term support chinese character?


(cyrilforce) #1

Hi All,

I m trying to use term query to do full text search with combination of
english and chinese character but it returned me empty records.

*Documents in the index : *

"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying out Elastic Search"
}

"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
* "message": "trying 汉字漢字 "*
}

"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
* "message": "trying汉字漢字 "*
}

*The index mapping : *

{
"tweet": {
"properties": {
* "message": {*

  •            "type": "string",*
    
  •            "index": "not_analyzed",*
    
  •            "omit_norms": true,*
    
  •            "index_options": "docs"*
    
  •        },*
          "post_date": {
              "type": "date",
              "format": "dateOptionalTime"
          },
          "user": {
              "type": "string"
          }
      }
    
    }
    }

*The query tested : *

1 )

{
"query" : {
"term" : { "message" : "trying汉字漢字" }
}
}

Result : Empty record

{
"query" : {
"term" : { "message" : "trying 汉字漢字" }
}
}

Result : Empty record
*
*
*
*
3.

{
"query" : {
"term" : { "message" : "trying out Elastic Search" }
}
}
Result : One record

My expected result is when i passed in "trying 汉字漢字" in the term query it
should return me the documents that have "trying 汉字漢字" (exact word match).

Any idea ? 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.


(Jun Ohtani) #2

Hi,

Your documents with chinese character in E-mail include two blank at the last of message string.

I try to index following documents, then your 3 query return one record each query.

1.-----

{
"_index": "test",
"_type": "tweet",
"_id": "1",
"_version": 1,
"exists": true,
"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying out Elastic Search"
}
}

2.-----
{
"_index": "test",
"_type": "tweet",
"_id": "2",
"_version": 1,
"exists": true,
"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying 汉字漢字"
}
}

3.-----
{
"_index": "test",
"_type": "tweet",
"_id": "3",
"_version": 1,
"exists": true,
"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying汉字漢字"
}
}


Jun Ohtani
johtani@gmail.com
blog : http://blog.johtani.info
twitter : http://twitter.com/johtani

On 2013/09/28, at 16:50, cyrilforce cheehoo84@gmail.com wrote:

Hi All,

I m trying to use term query to do full text search with combination of english and chinese character but it returned me empty records.

Documents in the index :

"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying out Elastic Search"
}

"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying 汉字漢字 "
}

"_source": {
"user": "kimchy",
"post_date": "2009-11-15T14:12:12",
"message": "trying汉字漢字 "
}

The index mapping :

{
"tweet": {
"properties": {
"message": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"post_date": {
"type": "date",
"format": "dateOptionalTime"
},
"user": {
"type": "string"
}
}
}
}

The query tested :

1 )

{
"query" : {
"term" : { "message" : "trying汉字漢字" }
}
}

Result : Empty record

{
"query" : {
"term" : { "message" : "trying 汉字漢字" }
}
}

Result : Empty record

{
"query" : {
"term" : { "message" : "trying out Elastic Search" }
}
}
Result : One record

My expected result is when i passed in "trying 汉字漢字" in the term query it should return me the documents that have "trying 汉字漢字" (exact word match).

Any idea ? 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.

--
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.


(system) #3