使用python在Elasticsearch中定义变量字段
这是我在Elasticsearch中的查询使用python在Elasticsearch中定义变量字段,python,
elasticsearch,Python,
elasticsearch,这是我在Elasticsearch中的查询 { "query": { "query_string": { "default_field": "Comment", "query": "Comment1" } } } } 我需要将“Comment1”更改为一个名为comment的变量。它现在正在工作 comment=somecomment { "query": {
{
"query": {
"query_string": {
"default_field": "Comment",
"query": "Comment1"
}
}
}
}
我需要将“Comment1”更改为一个名为comment的变量。它现在正在工作
comment=somecomment
{
"query": {
"query_string": {
"default_field": "Comment",
"query": 'Comment' + str(tweet['fields']['Comment']).lstrip('\'[u').rstrip(']\'')
}
}
}
好啊你那样做的时候发生了什么?