org.elasticsearch.index.query.SimpleQueryStringBuilder Java Examples

The following examples show how to use org.elasticsearch.index.query.SimpleQueryStringBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FactSearchManager.java    From act-platform with ISC License 5 votes vote down vote up
private QueryBuilder createFieldQuery(String field, String keywords) {
  SimpleQueryStringBuilder query = simpleQueryStringQuery(keywords)
          .field(field)
          // Values are indexed differently. Avoid errors when executing an IP search against a text field, for example.
          .lenient(true);
  // If field starts with the prefix 'objects.' it's part of the nested objects, thus, it must be wrapped inside a nested query.
  return field.startsWith("objects.") ? nestedQuery("objects", query, ScoreMode.Avg) : query;
}