django - Elasticsearch DSL queries not finding results -
i'm working on setting elasticsearch dsl django project.
when use elasticsearch dsl set index , doc_type works. use sense(chrome plugin) , curl double-check if index , doc_type mapping added, , objects want store added, , is.
the problem arises when use elasticsearch dsl api definitions submit queries - no results found.
def experimental_test(): connections.create_connection(hosts=['localhost:9200']) tests_index = index('tests_index') tests_index.settings( number_of_shards=1, number_of_replicas=0 ) tests_index.doc_type(test) tests_index.delete(ignore=404) tests_index.create() test.init() test = test(title='foo') test.save() s = search() s = s.doc_type(test) s = s.query('match', title='foo') print s.to_dict() response = s.execute()
here debug says sent elasticsearch (the actual query):
[info 2015-06-29 15:50:24,705 elasticsearch.trace] curl -xget 'http://localhost:9200/_all/test/_search?pretty' -d '{"query": {"match": {"title": "foo"}}}'
but no results found.
if copy query sense or terminal curl, finds it.
anyone have else have particular problem?
thanks answers might lead me understand problem is, or can done differently.
ps: api docs aren't helpful.
Comments
Post a Comment