我试着跟着教程走-http://ethen8181.github.io/machine-learning/search/bm25_intro.html#ElasticSearch-BM25
我通过作为守护进程运行成功地启动了弹性节点,它在发出查询-curl -X GET "localhost:9200/
时做出了响应
当我尝试在这里运行以下代码时,它返回400
settings = {
'settings': {
'index': {
'number_of_shards': 1,
'number_of_replicas': 1,
'similarity': {
'default': {
'type': 'BM25'
}
}
}
},
'mappings': {
'_doc': {
'properties': {
'title': {
'type': 'text',
'analyzer': 'english'
}
}
}
}
}
headers = {'Content-Type': 'application/json'}
response = requests.put('http://localhost:9200/experiment', data=json.dumps(settings), headers=headers)
response
我在这里做错了什么?我该如何解决这个问题
我基本上是试图索引一组文档,并使用BM25排名函数检索它们
调用
response.json()
或response.text
将为您提供响应主体,它可能会准确地告诉您请求有什么问题相关问题 更多 >
编程相关推荐