_source:{ exclude: [title] }

2015-03-22 Thread Debashish Paul
Hi,

I am facing a problem with using  _source:{ exclude: [title] } in my 
elastic query. Whenever I use this, my properties in the _source get 
shuffled. What am I doing wrong?

Example: 

Without _source:{ exclude: [title] }
-
_source:{
  title : ...
  prop1 : ...
  prop2 : ...
  prop3 : ...
  prop4 : ...
}

Without _source:{ exclude: [title] }
-
_source:{
  prop3 : ...
  prop1 : ...
  prop4 : ...
  prop2 : ...
}


Expected:
-
_source:{
  prop1 : ...
  prop2 : ...
  prop3 : ...
  prop4 : ...
}

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d31202f2-75d8-4232-ae25-1dd4acbcae95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Order of the properties gets changed if _source:{ exclude: [title] } is used in a query.

2015-03-22 Thread Debashish Paul
Hi,

I am facing a problem with using  _source:{ exclude: [title] } in my 
elastic query. Whenever I use this, my properties in the _source get 
shuffled. What am I doing wrong?

Example: 

Without _source:{ exclude: [title] }
-
_source:{
  title : ...
  prop1 : ...
  prop2 : ...
  prop3 : ...
  prop4 : ...
}

With _source:{ exclude: [title] }
-
_source:{
  prop3 : ...
  prop1 : ...
  prop4 : ...
  prop2 : ...
}


Expected:
-
_source:{
  prop1 : ...
  prop2 : ...
  prop3 : ...
  prop4 : ...
}

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/64c384c4-aae6-41f0-9ab5-4744015c55b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Combining Multiple Queries with 'OR' or 'AND'

2015-02-19 Thread Debashish Paul


Hi,
Question

I am trying to combine 2 user search queries using AND and OR as operation. 
I am aware of combining queries where we can merge filters, but I want to 
merge entire queries like { {BIG Elastic Query1} AND {BIG Elastic Query2} }.
Details

For instance say a user performs a search for batman in movies type with 
filters of Christian and Bale and another query Dark Knight in type 
tvshows with filters of Christopher Nolan. I want to combine both queries 
so I can look for both batman movies and Dark Knight tvshows, but not Dark 
knight movies or batman tvshows.

For example, for the given queries
I just want to run Query1 OR Query2 in the elasticsearch.
Query 1:

{
   query: {
  filtered: {
 query: { 
query_string:{  
   query:Batman,
   default_operator:AND,
   fields:[  
  Movies._all
   ]
}
 },
 filter: {
bool: {
   must: [  
  {  
 query:{  
filtered:{  
   filter:{  
  and:[  
 {  
term:{  
   cast.firstName:Christian
}
 },
 {  
term:{  
   cast.lastName:Bale
}
 }
  ]
   }
}
 }
  }
   ]
}
 }
  }
   }
}

Query2:

{
   query: {
  filtered: {
 query: { 
query_string:{  
   query:Dark Knight,
   default_operator:AND,
   fields:[  
  tvshows._all
   ]
}
 },
 filter: {
bool: {
   must: [  
  {  
 query:{  
filtered:{  
   filter:{  
  and:[  
 {  
term:{  
   director.firstName:Christopher
}
 },
 {  
term:{  
   director.lastName:Nolan
}
 }
  ]
   }
}
 }
  }
   ]
}
 }
  }
   }
}

-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/be301214-1b6a-4065-8c8e-f1e5048e9873%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.