我試圖對彈性數據駐留執行4操作。完全匹配(等於),包含,小於,大於。在彈性中有兩個選項,即查詢和過濾,從我迄今爲止所瞭解的內容來看,它們的確是相同的,但查詢會評估最符合數據條件 - 值關係的分數。搜索等於,包含,全文,lessthan,在彈性greaterthan
什麼,我想要做的是簡單的過濾或查詢(我很困惑,它是在他們的網站上提到的方式)
- 完全匹配像
name=Arjun
或age=29
或[email protected]
- 包含類似名稱包含
Ar
或電子郵件中含有不是像age>29
- 不是像
age<20
大
- 減
gmail.com
我使用這種格式到目前爲止(坦率地說我也沒時間做研究和實施)
{{ \"query\" : {{ \"filtered\" : {{ \"filter\" : {{ \"bool\" : {{ {{\"match\" : {\"" name "\" : \"" Arjun "\"} }} }} }} }} }} }}
以上格式包含
{{ \"query\" : {{ \"filtered\" : {{ \"filter\" : {{ \"bool\" : {{ {\"range\": {\"" age "\": {\"" + gt/lt+ "\": \"" 29 "\"} } } }} }} }} }} }}
以上爲格式大於或小於
我使用bool表達式按照此URL組合過濾器 https://www.elastic.co/guide/en/elasticsearch/guide/current/_most_important_queries_and_filters.html
如根據上面的鏈路,我們可以使用布爾到查詢組合並按照在實施例 { "bool": { "must": { "match": { "title": "how to make millions" }}, "must_not": { "match": { "tag": "spam" }}, "should": [ { "match": { "tag": "starred" }}, { "range": { "date": { "gte": "2014-01-01" }}} ] } }
i指定可以寫入相同的未經過濾,並在其內部過濾?
現在我想在我的(雜亂)代碼中實現equals,並且我有一種感覺,它不是那麼好的代碼。
請幫我
我加入C#作爲標記,因爲我使用C#創建查詢和使用的WebRequest –