Skip to content

Commit

Permalink
remove source in es params, remove fields in response
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Feb 15, 2024
1 parent 002b6f5 commit 6b49fb8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ pub struct SearchQueryParams {
#[serde(default)]
pub sort: Option<Vec<String>>,
#[serde(default)]
pub source: Option<String>,
#[serde(serialize_with = "to_simple_list")]
#[serde(deserialize_with = "from_simple_list")]
#[serde(default)]
pub stats: Option<Vec<String>>,
#[serde(serialize_with = "to_simple_list")]
#[serde(deserialize_with = "from_simple_list")]
Expand Down
11 changes: 2 additions & 9 deletions quickwit/quickwit-serve/src/elasticsearch_api/rest_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use std::collections::{BTreeMap, HashMap};
use std::collections::HashMap;
use std::str::from_utf8;
use std::sync::Arc;
use std::time::{Duration, Instant};
Expand Down Expand Up @@ -587,13 +587,6 @@ fn convert_hit(
Source::from_string(serde_json::to_string(&json).unwrap_or_else(|_| "{}".to_string()))
.unwrap_or_else(|_| Source::from_string("{}".to_string()).unwrap());

let mut fields: BTreeMap<String, serde_json::Value> = Default::default();
if let serde_json::Value::Object(map) = json {
for (key, val) in map {
fields.insert(key, val);
}
}

let mut sort = Vec::new();
if let Some(partial_hit) = hit.partial_hit {
if let Some(sort_value) = partial_hit.sort_value {
Expand All @@ -610,7 +603,7 @@ fn convert_hit(
}

ElasticHit {
fields,
fields: Default::default(),
explanation: None,
index: hit.index_id,
id: "".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ expected:
value: 7
relation: "eq"
hits:
- fields: { "count": 15, "id": 2 }
- fields: { "count": 10, "id": 0 }
- fields: { "count": 10, "id": 2 }
- fields: { "count": 10, "id": 1 }
- fields: {"count": -2.5, "id": 4}
- fields: { "id": 5 }
- fields: { "id": 3 }
- _source: { "count": 15, "id": 2 }
- _source: { "count": 10, "id": 0 }
- _source: { "count": 10, "id": 2 }
- _source: { "count": 10, "id": 1 }
- _source: {"count": -2.5, "id": 4}
- _source: { "id": 5 }
- _source: { "id": 3 }
---
endpoint: _elastic/sortorder/_search
json:
Expand All @@ -33,13 +33,13 @@ expected:
value: 7
relation: "eq"
hits:
- fields: {"count": -2.5, "id": 4}
- fields: {"count": 10, "id": 1 }
- fields: {"count": 10, "id": 2 }
- fields: {"count": 10, "id": 0 }
- fields: {"count": 15, "id": 2 }
- fields: {"id": 3}
- fields: {"id": 5}
- _source: {"count": -2.5, "id": 4}
- _source: {"count": 10, "id": 1 }
- _source: {"count": 10, "id": 2 }
- _source: {"count": 10, "id": 0 }
- _source: {"count": 15, "id": 2 }
- _source: {"id": 3}
- _source: {"id": 5}
---
endpoint: _elastic/sortorder/_search
json:
Expand All @@ -54,13 +54,13 @@ expected:
value: 7
relation: "eq"
hits:
- fields: {"count": 10, "id": 0 }
- fields: {"count": 10, "id": 1 }
- fields: {"count": 10, "id": 2 }
- fields: {"count": 15, "id": 2 }
- fields: {"id": 3}
- fields: {"count": -2.5, "id": 4}
- fields: {"id": 5}
- _source: {"count": 10, "id": 0 }
- _source: {"count": 10, "id": 1 }
- _source: {"count": 10, "id": 2 }
- _source: {"count": 15, "id": 2 }
- _source: {"id": 3}
- _source: {"count": -2.5, "id": 4}
- _source: {"id": 5}
---
endpoint: _elastic/sortorder/_search
json:
Expand All @@ -75,10 +75,10 @@ expected:
value: 7
relation: "eq"
hits:
- fields: {"count": 15, "id": 2 }
- fields: {"count": 10, "id": 2 }
- fields: {"count": 10, "id": 1 }
- fields: {"count": 10, "id": 0 }
- fields: {"count": -2.5, "id": 4}
- fields: {"id": 5}
- fields: {"id": 3}
- _source: {"count": 15, "id": 2 }
- _source: {"count": 10, "id": 2 }
- _source: {"count": 10, "id": 1 }
- _source: {"count": 10, "id": 0 }
- _source: {"count": -2.5, "id": 4}
- _source: {"id": 5}
- _source: {"id": 3}

0 comments on commit 6b49fb8

Please sign in to comment.