'_' search error

sorry for my English.
Search for ('xx_xx' or '_') by elasticsearch is not find ,why?how can i do?

How do you search, and what do you index?

On Thu, Nov 4, 2010 at 6:28 AM, Mr sun xlsunchaoyx@gmail.com wrote:

sorry for my English.
Search for ('xx_xx' or '_') by elasticsearch is not find ,why?how can i do?

search, For example, 'aa_bb_cc'
https://github.com/aparo/pyes, I do this

q = TermQuery("name", "aa_bb_cc")
conn.search(query = q)
NOW,it's other errors. thanks for you.

conn = ES('127.0.0.1:9200')

conn.create_index('test-index')

mapping = {u'name': {'boost': 1.0,'index': 'analyzed','store': 'yes','type':
u'string',"term_vector" : "with_positions_offsets"},u'value': {'boost':
1.0,'index': 'analyzed','store': 'yes','type': u'string',"term_vector" :
"with_positions_offsets"}}

conn.put_mapping("test-type", {'properties':mapping}, ["test-index"])

conn.index({'name':'aa_bb','value':'123'},'test-index','test-type',1)

conn.refresh(['test-index'])

1.##################
q1 = TermQuery('name','aa_bb')
conn.search(query = q1)

result:
{u'_shards': {u'failed': 0, u'successful': 65, u'total': 65},
u'hits': {u'hits': [], u'max_score': None, u'total': 0}}

2.#######################
q2 = TermQuery('value','123')
conn.search(query = q2)
result:
{u'_shards': {u'failed': 0, u'successful': 65, u'total': 65},
u'hits': {u'hits': [{u'_id': u'1',
u'_index': u'test-index',
u'_score': 0.30685282000000003,
u'_source': {u'name': u'aa_bb', u'value': u'123'},
u'_type': u'test-type'}],
u'max_score': 0.30685282000000003,
u'total': 1}}

I test this problem:
curl -XGET http://localhost:9200/permission/permission-type/_search -d '
{ "query" : { "wildcard" : { "name" : "*" } } }
' && echo
{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":12,"max_score":1.0,"hits":[{"_index":"permission","_type":"permission-type","_id":"department_set_hr","_score":1.0,
"_source" : {"codename": "department_set_hr", "name":
"\u7f16\u8f91\u90e8\u95e8"}},.......]}}

curl -XGET http://localhost:9200/permission/permission-type/_search -d '
{ "query" : { "term" : { "codename" : "department_set_hr" } } }
' && echo
{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.6931472,"hits":[{"_index":"permission","_type":"permission-type","_id":"department_set_hr","_score":1.6931472,
"_source" : {"codename": "department_set_hr", "name":
"\u7f16\u8f91\u90e8\u95e8"}}]}}

It is no problem.

2010/11/5 Mr sun xlsunchaoyx@gmail.com

search, For example, 'aa_bb_cc'
GitHub - aparo/pyes: Python connector for ElasticSearch - the pythonic way to use ElasticSearch, I do this

q = TermQuery("name", "aa_bb_cc")
conn.search(query = q)
NOW,it's other errors. thanks for you.

If there are problems with pyes, open an issue on github with an example and I'll fix it.

thanks
Alberto

Inviato da iPhone

Il giorno 05/nov/2010, alle ore 04:57, Ronald Bai ouyanghongyu@gmail.com ha scritto:

I test this problem:
curl -XGET http://localhost:9200/permission/permission-type/_search -d '
{ "query" : { "wildcard" : { "name" : "*" } } }
' && echo
{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":12,"max_score":1.0,"hits":[{"_index":"permission","_type":"permission-type","_id":"department_set_hr","_score":1.0, "_source" : {"codename": "department_set_hr", "name": "\u7f16\u8f91\u90e8\u95e8"}},.......]}}

curl -XGET http://localhost:9200/permission/permission-type/_search -d '
{ "query" : { "term" : { "codename" : "department_set_hr" } } }
' && echo
{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.6931472,"hits":[{"_index":"permission","_type":"permission-type","_id":"department_set_hr","_score":1.6931472, "_source" : {"codename": "department_set_hr", "name": "\u7f16\u8f91\u90e8\u95e8"}}]}}

It is no problem.

2010/11/5 Mr sun xlsunchaoyx@gmail.com
search, For example, 'aa_bb_cc'
GitHub - aparo/pyes: Python connector for ElasticSearch - the pythonic way to use ElasticSearch, I do this

q = TermQuery("name", "aa_bb_cc")
conn.search(query = q)

NOW,it's other errors. thanks for you.

mapping = {u'name': {'type': u'string','index':'not_analyzed'}}

it's ok!