0

I want to perform 4 filter search operations namely equal,greaterthan,lessthan and contains in elasticsearch data without using NEST and queries sent over HttpRequest.WebRequest.

When i googled i found in one post that URL query has limitation. Can anyone help me out . If its not possible can you provide me a URL or example on how to execute by passing the query as JSON over HttpRequest

ChintanShah25
  • 12,366
  • 3
  • 43
  • 44
Arjun Menon
  • 553
  • 2
  • 8
  • 29
  • I see that query & filters though performs same functionality has performance difference. Now i am confused. Say i want to query list of employees whose Age is 29 , Name contains aplhabet "A", Job is in IT,Salary greater than 10k and salary less than 20k . Which one shall i use then ?? A Query/filter – Arjun Menon Dec 20 '15 at 07:42
  • [This answer](http://stackoverflow.com/questions/14595988/queries-vs-filters) provides some clues. Though, you should note that as of ES 2.0 queries and filters [have been merged together](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_20_query_dsl_changes.html#_queries_and_filters_merged) – Val Dec 20 '15 at 08:00
  • Thanks for the link val. In the official site, they have given examples that can be run in CURL. What if we are to implement using webrequest. Say i connect to URL, send query as data over stream. I tried the query in REST client and response is showing it created, rather than fetching data – Arjun Menon Dec 20 '15 at 11:23
  • this is the URL : http://localhost:9200/testentity/TestDoc/ and this is the query i used as body as POST method { "query": { "filtered": { "query": { "match": { "tweet": "full text search" } }, "filter": { "range": { "created": { "gte": "now-1d/d" }} } } } } – Arjun Menon Dec 20 '15 at 11:24
  • response i got { "_index": "testentity" "_type": "TestDoc" "_id": "AVG_IutNbD06ETf1AsKv" "_version": 1 "_shards": { "total": 2 "successful": 1 "failed": 0 }- "created": true } – Arjun Menon Dec 20 '15 at 11:25
  • 1
    You need to POST your query to the `localhost:9200/testentity/TestDoc/_search` endpoint, otherwise you're just creating a new document. – Val Dec 20 '15 at 11:45
  • Yeah that was the thing missing :P. Thanks val... – Arjun Menon Dec 20 '15 at 12:12

0 Answers0