即使是不成熟的尝试,也胜于胎死腹中的策略。

ES查询方式不同,查询结果不同 &问题

Elasticsearch | 作者 ciziii | 发布于2016年08月30日 | 阅读数:5919

请大牛指正!通过curl查询:

2.jpg

通过浏览器查询:
[url=http://localhost:9200/cars/_search?pretty]http://localhost:9200/cars/_search?pretty[/url] -d '{"22query":{"match":{"price":20000}}}'

3.png

通过代码查询,使用 elasticsearch-dsl:
#coding:utf-8
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q

client = Elasticsearch('192.168.48.128:9200')
s = Search(using=client, index='cars')
s.query("match", make='toyota').query(~Q("match",make='honda'))
response = s.execute()
for hit in s:
    print (hit.make,hit.price)
 
查询结果也是不准确的,7条数据,和浏览器一样。  
ES里一共就7条数据。
已邀请:

ciziii

赞同来自:

请大牛指正!

zxper

赞同来自:

你看看是不是用的 put get方式不同造成的?

yangruideyang

赞同来自:

score都一样说明body没传过去

要回复问题请先登录注册